Erlang performance analysis using FPROF within the CPU time

I am trying to use fprof for better performance visualization of my software. However, the default is to use wall clock measurement, but I want to use cpu time to measure it. Therefore, I am in the shell I ran the following command, but an error occurred. Can’t really find the reason why it failed on the Internet or erlang documentation. Does anyone have any tips?

% fprof:trace([start, {cpu_time, true}]).
{error,not_supported}

The cpu_time flag of fprof is converted to the cpu_timestamp of trace, as shown in the code snippet above:

According to http://erlang.org/doc/man/erlang.html#trace-3:

cpu_timestamp

A global trace flag for the Erlang node that makes all trace timestamps be in CPU time, not wallclock. It is only allowed with PidSpec==all. If the host machine operating system does not support high resolution CPU time measurements, trace/3 exits with badarg.

So if you call erlang: trace(all,true,[cpu_timestamp]) returns badarg Abnormal, it means that your platform does not support this feature.

I am trying to use fprof for better performance visualization of my software. However, the default is to use a wall clock Measured, but I want to measure it with cpu time. Therefore, I ran the following command on the shell, but an error occurred. I can’t really find the reason why it failed on the Internet or erlang documentation. Does anyone have any tips?

% fprof:trace([start, {cpu_time, true}]).
{error,not_supported}

The cpu_time flag of fprof is converted to the cpu_timestamp of trace, as shown in the above code snippet:

According to http://erlang.org/doc/ man/erlang.html#trace-3:

cpu_timestamp

A global trace flag for the Erlang node that makes all trace timestamps be in CPU time, not wallclock. It is only allowed with PidSpec==all. If the host machine operating system does not support high resolution CPU time measurements, trace/3 exits with badarg.

So, if calling erlang:trace(all,true,[cpu_timestamp]) returns a badarg exception, it means that your platform does not support this feature .

Leave a Comment

Your email address will not be published.