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

can be used in virtualized environment such as virtualbox or kvm ? #99

Open
baiwfg2 opened this issue Feb 7, 2025 · 3 comments
Open

Comments

@baiwfg2
Copy link

baiwfg2 commented Feb 7, 2025

I know PMU is not supported in virtualbox linux. I'm wondering whether such environment is suitable for using uarch-bench

@travisdowns
Copy link
Owner

@baiwfg2 - yes, you can, probably, but you would need to use a different "timer" which is the thing that times regions of code. Pass --list-timers to read about them and you'd want the "clock" timer:

./uarch-bench --timer=clock ...

This timer just uses standard wall-clock time methods to do the timing, and will still convert that to cycles using a calibration loop. Depending on how often frequency changes are in your environment, this can still produce very accurate results in cycles, e.g., on my system w/o any special adjustment:

$ ./uarch-bench --timer=clock
Welcome to uarch-bench (e4f54d5-dirty)
Supported CPU features: SSE3 PCLMULQDQ VMX SMX EST TM2 SSSE3 FMA CX16 SSE4_1 SSE4_2 MOVBE POPCNT AES AVX RDRND TSC_ADJ SGX BMI1 AVX2 BMI2 ERMS MPX RDSEED ADX CLFLUSHOPT INTEL_PT
Pinned to CPU 0
WARNING: couldn't determine hugepage info (it's OK, you are probably not running as root)
UARCH_BENCH_CLOCK_MHZ not set, running calibration
Median CPU speed: 4.693 GHz
Running benchmarks groups using timer clock

** Running group basic : Basic Benchmarks **
                               Benchmark    Cycles     Nanos
                     Dependent add chain      1.00      0.21
                   Independent add chain      0.25      0.05
                  Dependent imul 64->128      2.94      0.63
                   Dependent imul 64->64      2.94      0.63
                Independent imul 64->128      1.01      0.21
                 Independent imul 64->64      1.00      0.21
                    Same location stores      1.00      0.21
                Disjoint location stores      1.00      0.21
                Dependent push/pop chain      4.41      0.94
              Independent push/pop chain      1.00      0.21
     Back-to-back call of empty function      4.38      0.93
            64-bit dependent div 1/1 = 1     31.47      6.71
           64-bit dependent idiv 1/1 = 1     38.88      8.29
                 same location inc [mem]      5.38      1.15
              same location add [mem], 1      5.38      1.15
                   multiple add [mem], 1      3.92      0.84
                        Calibration subs      0.98      0.21
                    Calibration subs x10      0.98      0.21
                   Calibration subs x10b      0.98      0.21
            Calibration subs w/ register      0.98      0.21
                 Calibration subs w/ nop      0.98      0.21
             Calibration subs value 1000      0.98      0.21
              Calibration subs value 100      0.98      0.21
                Calibration subs value 2      0.98      0.21
                Calibration subs value 1      0.98      0.21
                   1 dependent add chain      0.98      0.21
                   2 dependent add chain      1.01      0.22

@travisdowns
Copy link
Owner

(I forget if uarch-bench will automatically fall back to "clock" timer if the others don't work)

@baiwfg2
Copy link
Author

baiwfg2 commented Feb 13, 2025

@travisdowns I see. The reason I mentioned PMU is that I see PMU counters output in this Denis's post. The results(including yours in the comment) output INSTRUCTIONS_RETIRED | UOPS_ISSUED | UOPS_RETIRED | LSD.UOPS. But when I run ./uarch-bench --test-name=dendibakh/unfused-original I only see Benchmark Cycles Nanos. Why is that ?

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