Shell.PerfLog
Description: Reference for Shell.PerfLog

### Class

# ShellPerfLog

#### Description [src]

    final class Shell.PerfLog : GObject.Object
    {
      /* No available fields */
    }

Event recorder for performance measurement

ShellPerfLog provides a way for different parts of the code to record information for subsequent analysis and interactive exploration. Events exist of a timestamp, an event ID, and arguments to the event.

Emphasis is placed on storing recorded events in a compact fashion so log recording disturbs the execution of the program as little as possible, however events should not be recorded at too fine a granularity - an event that is recorded once per frame or once per user action is appropriate, an event that occurs many times per frame is not.

Arguments are identified by a D-Bus style signature; at the moment only a limited number of event signatures are supported to simplify the code.

#### Ancestors

- GObject

#### Functions

###### shell_perf_log_get_default

Gets the global singleton performance log. This is initially disabled and must be explicitly enabled with shell_perf_log_set_enabled().

#### Instance methods

###### shell_perf_log_add_statistics_callback

Adds a function that will be called before statistics are recorded. The function would typically compute one or more statistics values and call a function such as `shell_perf_log_update_statistic_i()` to update the value that will be recorded.

###### shell_perf_log_collect_statistics

Calls all the update functions added with `shell_perf_log_add_statistics_callback()` and then records events for all statistics, followed by a perf.statisticsCollected event.

###### shell_perf_log_define_event

Defines a performance event for later recording.

###### shell_perf_log_define_statistic

Defines a statistic. A statistic is a numeric value that is stored by the performance log and recorded periodically or when `shell_perf_log_collect_statistics()` is called explicitly.

###### shell_perf_log_dump_events

Dump the definition of currently defined events and statistics, formatted as JSON, to the specified output stream. The JSON output is an array, with each element being a dictionary of the form:.

###### shell_perf_log_dump_log

Writes the performance event log, formatted as JSON, to the specified output stream. For performance reasons, the output stream passed in should generally be a buffered (or memory) output stream, since it will be written to in small pieces. The JSON output is an array with the elements of the array also being arrays, of the form ‘[‘ , [, … ] ‘]’.

###### shell_perf_log_event

Records a performance event with no arguments.

###### shell_perf_log_event_i

Records a performance event with one 32-bit integer argument.

###### shell_perf_log_event_s

Records a performance event with one string argument.

###### shell_perf_log_event_x

Records a performance event with one 64-bit integer argument.

###### shell_perf_log_replay

Replays the log by calling the given function for each event in the log.

###### shell_perf_log_set_enabled

Sets whether events are currently being recorded.

###### shell_perf_log_update_statistic_i

Updates the current value of an 32-bit integer statistic.

###### shell_perf_log_update_statistic_x

Updates the current value of an 64-bit integer statistic.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct ShellPerfLogClass {
      GObjectClass parent_class;

    }

No description available.

###### Class members

`parent_class: GObjectClass`

  No description available.