Example #1
0
    def test_trace_no_packet_context(self):
        self._write_trace()
        traces = btr.TraceCollection()
        trace_handle = traces.add_trace(self._trace_path, 'ctf')
        self.assertIsNotNone(trace_handle)

        event_count = sum(1 for event in traces.events)
        self.assertEqual(self._expected_event_count, event_count)
Example #2
0
 def _check_trace_expected_timestamps(trace_paths, expected_timestamps):
     traces = btr.TraceCollection(intersect_mode=True)
     for trace_path in trace_paths:
         trace_handle = traces.add_trace(trace_path, 'ctf')
         if trace_handle is None:
             print('# Failed to open trace at {}'.format(trace_path))
             return False
     for event in traces.events:
         expected_timestamp = expected_timestamps.pop(0)
         if event.timestamp != expected_timestamp:
             print('# Unexpected timestamp ({}), expected {}'.format(
                 event.timestamp, expected_timestamp))
             return False
     return True
from utils import debugPrint
import math

# parse argument to get the program name and path
parser = argparse.ArgumentParser(description="Sort events")
parser.add_argument("--input_trace", help="set the input trace")
parser.add_argument("--output_trace", help="set the output trace destination")
parser.add_argument(
    "--gpu_log",
    help=
    "log file created by HC with GPU information (kernels, barriers, memcpy)")
args = parser.parse_args()

debugPrint("SORT EVENTS")
# Add the input trace to the collection
collection = btr.TraceCollection()

# Set the input traces
if args.input_trace == None:
    directory = os.getcwd() + "/../lttng-traces/"
    path = max([os.path.join(directory, d) for d in os.listdir(directory)],
               key=os.path.getmtime)
else:
    path = args.input_trace
if path[-1] == "/":
    path = path[:-1]
collection.add_trace(path + "/ust/uid/1000/64-bit", 'ctf')

# Set the output trace
if args.output_trace == None:
    out_path = "/tmp/tensorflow-profiler"