newtools / ebpf

eBPF Utilities, Maps, and more
MIT License
250 stars 23 forks source link

perf: Create ring for online, not possible CPUs #85

Closed arthurfabre closed 5 years ago

arthurfabre commented 5 years ago

Creating perf rings for CPUs that are "possible" but not "online" (see https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-system-cpu) fails with:

failed to create perf ring for CPU 64: this processor architecture
does not support this event type

Determine the number of CPUs from the "online" ones. We only support parsing continuous 0 indexed ranges of CPU numbers, but the sysfs files can potentially contain multiple ranges (see get_nproc() in glibc), as this means we can use a simple cpu count and not worry about the ids / numbers.

codecov-io commented 5 years ago

Codecov Report

Merging #85 into master will increase coverage by 0.3%. The diff coverage is 76.47%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #85     +/-   ##
=========================================
+ Coverage   58.66%   58.97%   +0.3%     
=========================================
  Files          24       24             
  Lines        1841     1845      +4     
=========================================
+ Hits         1080     1088      +8     
+ Misses        596      593      -3     
+ Partials      165      164      -1
Impacted Files Coverage Δ
perf.go 73.97% <100%> (ø) :arrow_up:
marshalers.go 69.74% <75%> (+4.53%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0b135e6...1bc4363. Read the comment docs.