lkml.org 
[lkml]   [2023]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 9/9] scripts: python: Add temporary main function for testing purposes
This commit introduces a temporary main function for ease of testing.
Please note that this function is not intended to be a permanent
part of the codebase.

The output is serialized as JSON and printed to the standard output
(stdout) with an indentation of 2 for better readability.

Signed-off-by: Anup Sharma <anupnewsmail@gmail.com>
---
tools/perf/scripts/python/firefox-gecko-converter.py | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools/perf/scripts/python/firefox-gecko-converter.py
index 385a8b77a70a..0f133d9acee9 100644
--- a/tools/perf/scripts/python/firefox-gecko-converter.py
+++ b/tools/perf/scripts/python/firefox-gecko-converter.py
@@ -236,3 +236,14 @@ def convertPerfScriptProfile(profile):
'pausedRanges': []
}

+def main():
+# inputFile = input('Enter input file name: ')
+ with open('perf_data.txt') as f:
+ profile = f.read()
+ isPerfScript = isPerfScriptFormat(profile)
+ output = convertPerfScriptProfile(profile)
+ json.dump(output, sys.stdout, indent=2)
+# print('isPerfScript: {}'.format(isPerfScript))
+
+if __name__ == '__main__':
+ main()
--
2.34.1
\
 
 \ /
  Last update: 2023-06-21 21:48    [W:0.101 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site