Percept, or Percept - Erlang Concurrency Profiling Tool, utilizes trace informations and profiler events to form a picture of the processes's and ports runnability.
Percept uses
There are some other states too,
A waiting or suspended process is considered an inactive process and a running or runnable process is considered an active process.
Events are collected and stored to a file. The file can be moved and analyzed on a different machine than the target machine.
Note, even if percept is not installed on your target machine, profiling
can still be done via the module
There are a few ways to start the profiling of a specific code. The
command
The command takes a filename for the data destination file as first
argument, a callback entry-point as second argument and a
list of specific profiler options, for instance
Let's say we have a module called example that initializes our profiling-test and let it run under some defined manner designed by ourself. The module needs a start function, let's call it go and it takes zero arguments. The start arguments would look like:
For a semi-real example we start a tree of processes that does sorting of random numbers. In our model below we use a controller process that distributes work to different client processes.
We can now start our test using percept:
Erlang (BEAM) emulator version 5.6 [async-threads:0] [kernel-poll:false] Eshell V5.6 (abort with ^G) 1> percept:profile("test.dat", {sorter, go, [5, 2000, 15]}, [procs]). Starting profiling. ok
Percept sets up the trace and profiling facilities to listen for process
specific events. It then stores these events to the
To analyze this file, use
2> percept:analyze("test.dat"). Parsing: "test.dat" Parsed 428 entries in 3.81310e-2 s. 17 created processes. 0 opened ports. ok
To view the data we start the web-server using
3> percept:start_webserver(8888). {started,"durin",8888} 4>
Now we can view our data. The database has its content from
When we click on the
We can zoom in on different areas of the graph either using the mouse to select an area or by specifying min and max ranges in the edit boxes.
Measured time is presented in seconds if nothing else is stated.
To get a more detailed description we can select the process view by
clicking the
The table shows process id's that are click-able and direct you to the process information page, a lifetime bar that presents a rough estimate in green color about when the process was alive during profiling, an entry-point, its registered name if it had one and the process's parent id.
We can select which processes we want to compare and then hit the
The activity bar under the concurrency graph shows each process's runnability. The color green shows when a process is active (which is running or runnable) and the white color represents time when a process is inactive (waiting in a receive or is suspended).
To inspect a certain process click on the process id button, this will direct you to a process information page for that specific process.
Here we can some general information for the process. Parent and children processes, spawn and exit times, entry-point and start arguments.
We can also see the process' inactive times. How many times it has been waiting, statistical information and most importantly in which function.
The time percentages presented in process information are of time spent in waiting, not total run time.