mstange / samply

Command-line sampling profiler for macOS and Linux
Apache License 2.0
1.96k stars 48 forks source link

Change the marker API in fxprof-processed-profile and add support for deduplicated string fields in markers #254

Closed mstange closed 3 weeks ago

mstange commented 3 weeks ago

This commit makes the following changes:

  1. The main trait has been renamed from ProfilerMarker to Marker, and a new trait named StaticSchemaMarker has been added.
  2. The static and dynamic fields in the marker schema are now specified separately, in the schema's fields and static_fields properties.
  3. You can now define schemas at runtime. Previously, the schema had to be known at compile time.
  4. The marker name and category are now part of the marker, and are no longer specified as separate arguments.
  5. The values for the dynamic fields are now queried from two new methods, string_field_value and number_field_value. The previous method named json_marker_data has been removed.
  6. Strings are now serialized as string indexes. This saves space when multiple markers use the same string field value.

The string deduplication reduced the JSON size from 350MB to 210MB on one example profile I was testing with (4 iterations of sp3 with lots of JitFunctionAdd markers and --reuse-threads).