]> Git Repo - linux.git/blobdiff - tools/perf/scripts/python/export-to-sqlite.py
Merge branches 'arm/tegra', 'arm/mediatek', 'arm/smmu', 'x86/vt-d', 'x86/amd' and...
[linux.git] / tools / perf / scripts / python / export-to-sqlite.py
index 3da338243aed3d14a8a5b044064ba10a174ce014..bf271fbc3a885f509d78ee60fbb0138fd12df53f 100644 (file)
@@ -65,6 +65,9 @@ perf_db_export_callchains = False
 def printerr(*args, **keyword_args):
        print(*args, file=sys.stderr, **keyword_args)
 
+def printdate(*args, **kw_args):
+        print(datetime.datetime.today(), *args, sep=' ', **kw_args)
+
 def usage():
        printerr("Usage is: export-to-sqlite.py <database name> [<columns>] [<calls>] [<callchains>]");
        printerr("where:        columns         'all' or 'branches'");
@@ -105,7 +108,7 @@ def do_query_(q):
                return
        raise Exception("Query failed: " + q.lastError().text())
 
-print(datetime.datetime.today(), "Creating database ...")
+printdate("Creating database ...")
 
 db_exists = False
 try:
@@ -328,7 +331,7 @@ if perf_db_export_calls:
                        'return_id,'
                        'CASE WHEN flags=0 THEN \'\' WHEN flags=1 THEN \'no call\' WHEN flags=2 THEN \'no return\' WHEN flags=3 THEN \'no call/return\' WHEN flags=6 THEN \'jump\' ELSE flags END AS flags,'
                        'parent_call_path_id,'
-                       'parent_id'
+                       'calls.parent_id'
                ' FROM calls INNER JOIN call_paths ON call_paths.id = call_path_id')
 
 do_query(query, 'CREATE VIEW samples_view AS '
@@ -383,7 +386,7 @@ if perf_db_export_calls:
        call_query.prepare("INSERT INTO calls VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
 
 def trace_begin():
-       print(datetime.datetime.today(), "Writing records...")
+       printdate("Writing records...")
        do_query(query, 'BEGIN TRANSACTION')
        # id == 0 means unknown.  It is easier to create records for them than replace the zeroes with NULLs
        evsel_table(0, "unknown")
@@ -402,14 +405,14 @@ unhandled_count = 0
 def trace_end():
        do_query(query, 'END TRANSACTION')
 
-       print(datetime.datetime.today(), "Adding indexes")
+       printdate("Adding indexes")
        if perf_db_export_calls:
                do_query(query, 'CREATE INDEX pcpid_idx ON calls (parent_call_path_id)')
                do_query(query, 'CREATE INDEX pid_idx ON calls (parent_id)')
 
        if (unhandled_count):
-               print(datetime.datetime.today(), "Warning: ", unhandled_count, " unhandled events")
-       print(datetime.datetime.today(), "Done")
+               printdate("Warning: ", unhandled_count, " unhandled events")
+       printdate("Done")
 
 def trace_unhandled(event_name, context, event_fields_dict):
        global unhandled_count
This page took 0.035042 seconds and 4 git commands to generate.