Lines Matching +full:json +full:- +full:schema

1 # gecko.py - Convert perf record output to Firefox's gecko profile format
2 # SPDX-License-Identifier: GPL-2.0
9 # perf record -a -g -F 99 sleep 60
14 # perf script gecko -F 99 -a sleep 60
19 import json
32 # Add the Perf-Trace-Util library to the Python path
34 '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
48 # https://github.com/firefox-devtools/profiler/blob/53970305b51b9b472e26d7457fee1d66cd4e2737/src/ty…
53 PRODUCT = os.popen('uname -op').read().strip()
68 # https://github.com/firefox-devtools/profiler/blob/53970305b51b9b472e26d7457fee1d66cd4e2737/src/ty…
80 # https://github.com/firefox-devtools/profiler/blob/53970305b51b9b472e26d7457fee1d66cd4e2737/src/ty…
85 # https://github.com/firefox-devtools/profiler/blob/53970305b51b9b472e26d7457fee1d66cd4e2737/src/ty…
96 comm: Thread command-line (name).
100 frameTable: interned stack frame ID -> stack frame.
101 stringTable: interned string ID -> string.
102 stringMap: interned string -> string ID.
103 stackTable: interned stack ID -> stack.
104 stackMap: (stack prefix ID, leaf stack frame ID) -> interned Stack ID.
105 frameMap: Stack Frame string -> interned Frame ID.
128 def _intern_stack(self, frame_id: int, prefix_id: Optional[int]) -> int:
140 def _intern_string(self, string: str) -> int:
150 def _intern_frame(self, frame_str: str) -> int:
159 symbol_name_to_category = KERNEL_CATEGORY_INDEX if frame_str.find('kallsyms') != -1 \
160 or frame_str.find('/vmlinux') != -1 \
177 def _add_sample(self, comm: str, stack: List[str], time_ms: Milliseconds) -> None:
180 comm: command-line (name) of the thread at this sample
196 def _to_json_dict(self) -> Dict:
197 """Converts current Thread to GeckoThread JSON format."""
198 # Gecko profile format is row-oriented data as List[List],
199 # And a schema for interpreting each index.
200 # Schema:
201 # https://github.com/firefox-devtools/profiler/blob/main/docs-developer/gecko-profile-format.md
202 …# https://github.com/firefox-devtools/profiler/blob/53970305b51b9b472e26d7457fee1d66cd4e2737/src/t…
207 …# https://github.com/firefox-devtools/profiler/blob/53970305b51b9b472e26d7457fee1d66cd4e2737/src/t…
209 "schema": {
220 …# https://github.com/firefox-devtools/profiler/blob/53970305b51b9b472e26d7457fee1d66cd4e2737/src/t…
222 "schema": {
230 …# https://github.com/firefox-devtools/profiler/blob/53970305b51b9b472e26d7457fee1d66cd4e2737/src/t…
232 "schema": {
246 …# https://github.com/firefox-devtools/profiler/blob/53970305b51b9b472e26d7457fee1d66cd4e2737/src/t…
248 "schema": {
262 def process_event(param_dict: Dict) -> None:
283 stack = stack[::-1]
285 # During perf record if -g is not used, the callchain is not available.
299 def trace_begin() -> None:
309 # the data into the final json object and print it out to stdout.
310 def trace_end() -> None:
314 …# Schema: https://github.com/firefox-devtools/profiler/blob/53970305b51b9b472e26d7457fee1d66cd4e27…
336 # launch the profiler on local host if not specified --save-only args, otherwise print to file
338 output_file = 'gecko_profile.json'
340 json.dump(gecko_profile_with_meta, f, indent=2)
347 json.dump(gecko_profile_with_meta, f, indent=2)
349 # Used to enable Cross-Origin Resource Sharing (CORS) for requests coming from 'https://profiler.fi…
352 self.send_header('Access-Control-Allow-Origin', 'https://profiler.firefox.com')
355 # start a local server to serve the gecko_profile.json file to the profiler.firefox.com
358 url = 'https://profiler.firefox.com/from-url/' + safe_string
361 def main() -> None:
366 # Add the command-line options
368 …# https://github.com/firefox-devtools/profiler/blob/50124adbfa488adba6e2674a8f2618cf34b59cd2/res/c…
369 …parser.add_argument('--user-color', default='yellow', help='Color for the User category', choices=…
370 …parser.add_argument('--kernel-color', default='orange', help='Color for the Kernel category', choi…
371 …# If --save-only is specified, the output will be saved to a file instead of opening Firefox's pro…
372 …parser.add_argument('--save-only', help='Save the output to a file instead of opening Firefox\'s p…
374 # Parse the command-line arguments