Schedplot: a scalability profiler for Erlang programs
What’s a Schedplot?
Schedplot (SCHEDuler PLOTter) is a profiler for Erlang programs I developed for my thesis during the last year. It visualizes the workload of Erlang’s schedulers, which can be used to detect bottlenecks and scalability issues in multicore architectures.
In other words, Schedplot aspires to answer a simple question: why a program doesn’t run twice as fast if the number of available processors is doubled?
This sounds familiar to…
## Schedplot example So, without further ado, here’s a screenshot:
The profiled program spawns 5 processes: each one calculates a Fibonacci number (28, 29, 30, 31, 32). The program runs in a VM using 4 schedulers (S1-S4). It is trivial to realize why the program doesn’t have ideal speedup; although we have more than 4 processes, their work load is unbalanced and 3 schedulers are inactive while the 4th calculates fib(32)
How do you know that the last one is fib(32)?
Well, see that red line at the end with the
end32 label? That’s the result of using
schedplot:print/1, which prints a message on the graph (the message is placed on the scheduler on which the process that called it was running). In our case, when a process has finished the calculations it prints
endN where N is the Fibonacci number it was calculating.
So what do we actually see in the chart?
Well, no, not really lazy. Each pixel is corresponds not to a single moment (1us); hence, in 10us a scheduler may be inactive for 5us and active for 5us and will be displayed as 50% active.
What will happen if in 100us the scheduler is 99% active but the chart height is 10pixel?
It will be 9 pixel. The graph has max height if and only if the scheduler is 100% active; otherwise, the visualization could hide significant gaps.
Symmetrically, the height is zero if and only if the scheduler is 0% active.