Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux perf file descriptor not readable #43

Closed
cometkim opened this issue Jan 9, 2025 · 9 comments
Closed

linux perf file descriptor not readable #43

cometkim opened this issue Jan 9, 2025 · 9 comments

Comments

@cometkim
Copy link
Contributor

cometkim commented Jan 9, 2025

Not sure the exact reason, mitata reported like:

clk: ~2.76 GHz
cpu: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz
runtime: node 23.6.0 (x64-linux)

benchmark                                     avg (min … max) p75   p99    (min … top 1%)
------------------------------------------------------------- -------------------------------
• Lorem ipsum (ascii)
------------------------------------------------------------- -------------------------------
unicode-segmenter/grapheme                     error: NotOpenForReading
graphemer                                      error: NotOpenForReading
grapheme-splitter                              error: NotOpenForReading
@formatjs/intl-segmenter                       error: NotOpenForReading
unicode-rs/unicode-segmentation (wasm-bindgen) error: NotOpenForReading
Intl.Segmenter                                 error: NotOpenForReading

Downgrading counters to v0.0.5 fixes the issue
cometkim/unicode-segmenter#69

@evanwashere
Copy link
Owner

interesting that downgrading fixed it because for node there is no difference between 0.0.5 and 0.0.7

@evanwashere
Copy link
Owner

I released v1.0.27 that ignores errors from hardware counters and continues without them

@evanwashere evanwashere changed the title @mitata/counters v0.7 fails with error: NotOpenForReading linux perf file descriptor not readable Jan 9, 2025
@evanwashere
Copy link
Owner

evanwashere commented Jan 9, 2025

ive searched through linux perf docs but couldn't find any explanation for intermediate file descriptor error. maybe you had some other program using hardware counters at same time?

you should be able to upgrade back to latest version given that there is no actual difference between syscalls they do

@cometkim
Copy link
Contributor Author

cometkim commented Jan 9, 2025

maybe you had some other program using hardware counters at same time?

I don't think so? @mitata/counters 0.0.5~0.0.8 fails in miatata 1.0.26 constantly, but upgrade mitata to 1.0.27 fixed the issue.

clk: ~2.81 GHz
cpu: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz
runtime: node 23.6.0 (x64-linux)

benchmark                                     avg (min … max) p75   p99    (min … top 1%)
------------------------------------------------------------- -------------------------------
• Lorem ipsum (ascii)
------------------------------------------------------------- -------------------------------
unicode-segmenter/grapheme                      10.01 µs/iter  10.05 µs     █                
                                         (9.90 µs … 10.13 µs)  10.09 µs █▁▁▁█▁█▁█▁█▁█▁▁███▁▁█
                                     NaNP ipc (   NaN% cache)    0.00 branch misses
                             0.00 cycles    0.00 instructions    0.00 c-refs    0.00 c-misses

There appears to be a bug (NaN) in the newly added report, but all existing features work fine.

@cometkim
Copy link
Contributor Author

cometkim commented Jan 9, 2025

I'm not sure what this means exactly, but is it likely that versions of @mitata/counters prior to v0.0.5 weren't working correctly on my machine either?

@evanwashere
Copy link
Owner

could you provide output of perf list hw command? (need to install linux tools if you don't have perf bin)

@evanwashere
Copy link
Owner

could also be potentially permissions issue, tried running it with sudo?

@cometkim
Copy link
Contributor Author

cometkim commented Jan 9, 2025

could you provide output of perf list hw command? (need to install linux tools if you don't have perf bin)

Ohhh I got it. perf list hw printed nothing. So I checked my kernel.perf_event_paranoid and it was 4, Ubuntu's default I guess.

After adjusting it with sudo sysctl -w kernel.perf_event_paranoid=1, everything works fine. It would be good to add it to the README.

@cometkim cometkim closed this as completed Jan 9, 2025
@evanwashere
Copy link
Owner

added to docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants