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

Add drmemtrace schedule analysis tool #6426

Open
derekbruening opened this issue Nov 9, 2023 · 0 comments
Open

Add drmemtrace schedule analysis tool #6426

derekbruening opened this issue Nov 9, 2023 · 0 comments

Comments

@derekbruening
Copy link
Contributor

derekbruening commented Nov 9, 2023

#5843 covered creating a drmemtrace scheduler supporting a variety of schedules.

#5694 hooked the scheduler up to the analysis tool framework.

This issue covers creating an analysis tool that computes statistics about a schedule and provides some rough visualization of the interleavings. The sched_launcher tool was a step in that direction, but an analysis tool is a better solution as it more easily fits into and combines with other tools and existing framework adaptations.

Here is my prototype, where I cranked up the quantum so we have no preempts as a test to see 100% voluntary switches (this counts a thread exit as a voluntary switch):

$ bin64/drrun -t drcachesim -simulator_type schedule_stats -indir ../src/clients/drcachesim/tests/drmemtrace.threadsig.x64.tracedir/ -core_sharded -print_every 5000 -sched_quantum 1000000
Schedule stats tool results:
Total counts:
           4 cores
           8 threads
      638938 instructions
           5 total context switches
   0.0000078 CSPKI (context switches per 1000 instructions)
           5 voluntary context switches
           0 direct context switches
      100.00% voluntary switches
        0.00% direct switches
         161 system calls
           2 maybe-blocking system calls
           0 direct switch requests
Core #0 counts:
           2 threads
      117015 instructions
           2 total context switches
   0.0000171 CSPKI (context switches per 1000 instructions)
           2 voluntary context switches
           0 direct context switches
      100.00% voluntary switches
        0.00% direct switches
         125 system calls
           2 maybe-blocking system calls
           0 direct switch requests
Core #1 counts:
           2 threads
      170399 instructions
           1 total context switches
   0.0000059 CSPKI (context switches per 1000 instructions)
           1 voluntary context switches
           0 direct context switches
      100.00% voluntary switches
        0.00% direct switches
          10 system calls
           0 maybe-blocking system calls
           0 direct switch requests
Core #2 counts:
           2 threads
      175759 instructions
           1 total context switches
   0.0000057 CSPKI (context switches per 1000 instructions)
           1 voluntary context switches
           0 direct context switches
      100.00% voluntary switches
        0.00% direct switches
          13 system calls
           0 maybe-blocking system calls
           0 direct switch requests
Core #3 counts:
           2 threads
      175765 instructions
           1 total context switches
   0.0000057 CSPKI (context switches per 1000 instructions)
           1 voluntary context switches
           0 direct context switches
      100.00% voluntary switches
        0.00% direct switches
          13 system calls
           0 maybe-blocking system calls
           0 direct switch requests
Core #0 schedule: FFFFFF,HHHHHHHHHHHHHHHHHHH,FFF
Core #1 schedule: DDDDDDDDDDDDDDDDDD,CCCCCCCCCCCCCCCCCCC
Core #2 schedule: GGGGGGGGGGGGGGGGGGG,EEEEEEEEEEEEEEEEEEE
Core #3 schedule: BBBBBBBBBBBBBBBBBBB,AAAAAAAAAAAAAAAAAAA
@derekbruening derekbruening self-assigned this Nov 9, 2023
derekbruening added a commit that referenced this issue Nov 10, 2023
Adds a new analysis tool "schedule_stats" which computes
characteristics of a core-sharded schedule.  This is meant to help in
understanding and studying the effects of varying the scheduler
parameters.

This initial version counts instructions, blocking and all syscalls,
voluntary and direct switches, and direct requests, and computes
derived statistics CSPKI, I/CS, %voluntary, and %direct switches.
Failed direct requests can be inferred.

The tool also records a string of letters representing input threads
to help visualize the thread interleaving on each core.  The number of
instructions per leter is controlled by a new parameter -print_every.
This string visualization has its limits as more than 26 inputs will
wrap around, but this approach has been useful in our unit tests and
other small runs.

Adds a regression test which runs the checked-in threadsig trace.

Issue: #6426
derekbruening added a commit that referenced this issue Nov 11, 2023
Adds a new analysis tool "schedule_stats" which computes characteristics
of a core-sharded schedule. This is meant to help in understanding and
studying the effects of varying the scheduler parameters.

This initial version counts instructions, blocking and all syscalls,
voluntary and direct switches, and direct requests, and computes derived
statistics CSPKI, I/CS, %voluntary, and %direct switches. Failed direct
requests can be inferred.

The tool also records a string of letters representing input threads to
help visualize the thread interleaving on each core. The number of
instructions per leter is controlled by a new parameter -schedule_stats_print_every.
This string visualization has its limits as more than 26 inputs will
wrap around, but this approach has been useful in our unit tests and
other small runs.

Adds a regression test which runs the checked-in threadsig trace.

Issue: #6426
derekbruening added a commit that referenced this issue Apr 25, 2024
Adds the list of threads per cpu to the schedule_stats output.
Updates the schedule_stats tests to confirm some tids are printed.

Issue: #6426
derekbruening added a commit that referenced this issue Apr 25, 2024
Adds the list of threads per cpu to the schedule_stats output. Updates
the schedule_stats tests to confirm some tids are printed.

Issue: #6426
derekbruening added a commit that referenced this issue May 9, 2024
Adds a very simple histogram with fixed bin sizes recording the
distribution of instructions per context switch in the schedule_stats
tool.

Updates two tests to confirm the histogram is produced.

This feature is structured to allow replacing this simple histogram
with a more sophisticated version in subclasses.

Issue: #6426
derekbruening added a commit that referenced this issue May 14, 2024
Adds a very simple histogram with fixed bin sizes recording the
distribution of instructions per context switch in the schedule_stats
tool.

Updates two tests to confirm the histogram is produced.

This feature is structured to allow replacing this simple histogram with
a more sophisticated version in subclasses.

Issue: #6426
philramsey-arm pushed a commit that referenced this issue May 14, 2024
Adds a very simple histogram with fixed bin sizes recording the
distribution of instructions per context switch in the schedule_stats
tool.

Updates two tests to confirm the histogram is produced.

This feature is structured to allow replacing this simple histogram with
a more sophisticated version in subclasses.

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

No branches or pull requests

1 participant