Fix: use path to kernel trace to look up tracer version
authorAntoine Busque <abusque@efficios.com>
Mon, 14 Dec 2015 15:53:39 +0000 (10:53 -0500)
committerAntoine Busque <abusque@efficios.com>
Mon, 14 Dec 2015 15:53:39 +0000 (10:53 -0500)
Currently, only the lttng-modules version is of use for the
analyses. However, multi-domain traces, combining UST and modules,
could lead to unpredictable results wherein the tracer_version was
erroneously identified as that of the userspace tracer, which was
problematic when its version differed from that of the kernel tracer.

Extracting the version directly from the kernel trace's metadata
corrects this issue.

Signed-off-by: Antoine Busque <abusque@efficios.com>
lttnganalyses/cli/command.py

index ef9d32f3161036306738b3fb3a6369725122e365..93df78657c181e41d43422ad9ac6673c0d12a3e2 100644 (file)
@@ -24,6 +24,7 @@
 
 import argparse
 import json
+import os
 import re
 import sys
 import subprocess
@@ -172,9 +173,18 @@ class Command:
             self._traces.remove_trace(handle)
 
     def _read_tracer_version(self):
+        kernel_path = None
+        for root, _, _ in os.walk(self._args.path):
+            if root.endswith('kernel'):
+                kernel_path = root
+                break
+
+        if kernel_path is None:
+            self._gen_error('Could not find kernel trace directory')
+
         try:
             metadata = subprocess.getoutput(
-                'babeltrace -o ctf-metadata "%s"' % self._args.path)
+                'babeltrace -o ctf-metadata "%s"' % kernel_path)
         except subprocess.CalledProcessError:
             self._gen_error('Cannot run babeltrace on the trace, cannot read'
                             ' tracer version')
This page took 0.027608 seconds and 5 git commands to generate.