Page MenuHomePhabricator

Dev Wiki
Updated 357 Days AgoPublic

This page created for sharing knowledge about algorithms and data structures used in Profiler..

Profiler Workflow

Initial log read

At start Profiler need some time for parsing all log-file. It is only one time, when full log read, in continues workflow Profiler reads only small parts from log-file that related to given event. Goal of this part: fill structures that provide direct access to every event in log-file and collect global data about log(like number of CPU cores or max value of frequency. Most of this functions works in separated thread, so ELM_MAIN_LOOP idles.

Log Structure

Log consists blocks that represent Eina_Evlog_Buf structures. Each block have header and many events after it.
Header consist from three int numbers:

  1. magic number 0x0ffee211 for verify log file.
  2. size of block without header
  3. overflow parameter.

Each event consists Eina_Evlog_Item in binary format and two strings for event name and details. Size of this string can be calculated from event_offset and detail_offset in Eina_Evlog_Item.

Event Collecting

Profiler has direct access to any event in log file by saving offsets of event start and finish in structure Event_Offsets. At first reading all log for every event need to update global data, update graphs and save this this event offsets.

Structures for storing events

Atomic structures of events:

  • Event_Offsets: represent single thread or state event. Contain offsets to start and end of this event, start and end time and thread slot for relation with thread where it happens.. State events have thread_slot = -1.
  • Log_Cpu_Use: represent single CPUUSED event. Contain time when happen and cpu value at this time.
  • Log_Cpu_Freq: represent single CPUFREQ event. Contein time when happen, cpufreq value and core.

Complex structures:

  • Log_Thread: represent single thread. Contain pointer to it, max value of simultaneous events in it and array of all Log_Cpu_Use structures related to this thread.
  • Offsets: contain array of all Log_Cpu_Freq structs and array of all Log_Thread structures.
  • Event_Info_State: represent all state events with same name. Contain name, color for displaying in ui, filtration status, slot for grid where it would be displayed and array of all Event_Offsets structures of state events with this name. All Event_Info_State stored in hash table and can be accessed by name.
  • Event_Info_Thread: represent all thread events with same name. Contain name, color for displaying in ui, filtration status and array with Thread_Events structures for all threads where this event happened, In each Thread_Events stored pointer to related Log_Thread and array of Event_Offsets structures of thread events with this name that happens in this thread. All Event_Info_Thread stored in hash table and can be accessed by name.
  • Pointer_To_Time: this struct need for recovering events that started before interval without analyze all events before. New Pointer_To_Time filled at end of reading block. All Pointer_To_Time structures saved in one list. This structure contain time of first event in block for searching for actual Pointer_To_Time for current time interval, offsets to start and end of block, list of Event_Offsets for events, that have started and haven`t finished before block and lat registered value of cpu frequency before block for each core.

Graphs

Last Author
Deepwarrior
Last Edited
Oct 2 2017, 8:39 AM
Projects
None
Subscribers
NikaWhite, i.furs