957bb7a4e5
* Perfetto submodule * include/rocprofiler-sdk/cxx/perfetto.hpp - adapted from tests/common/perfetto.hpp - updated json-tool to use <rocprofiler-sdk/cxx/perfetto.hpp> * Update include/rocprofiler-sdk/cxx - add details/delimit.hpp - add details/join.hpp - extend details/mpl.hpp - extend details/operators.hpp * Update lib/rocprofiler-sdk/hsa/async_copy.cpp - update MEMORY_COPY direction names * Preliminary perfetto support * Update lib/rocprofiler-sdk-tool/generatePerfetto.cpp - fix getting roctx msg vs. buffer operation name * Temporary variable restructuring * Perfetto patches after rebasing onto main * Revert lib/rocprofiler-sdk/hsa/async_copy.cpp - revert name * Update lib/rocprofiler-sdk-tool/generatePerfetto.cpp - fix ReadTrace * Update tests/bin/hip-in-libraries - sleep_for * Support PFTRACE output format option in rocprofv3 * Change perfetto logging * Update rocprofv3 tests to generate pftrace output * Minor tweak to json-tool.cpp * Update requirements.txt for perfetto testing * Fix data race on amount_read in generatePerfetto.cpp * Add testing for pftrace output - relatively simple testing which verifies that the pftrace file has the same number of entries as JSON data for HIP/HSA/marker/kernel/memory_copy * Fix import in perfetto_reader.py * Fix data race in generatePerfetto.cpp
70 Zeilen
1.6 KiB
Python
70 Zeilen
1.6 KiB
Python
#!/usr/bin/env python3
|
|
|
|
import csv
|
|
import pytest
|
|
import json
|
|
|
|
from rocprofiler_sdk.pytest_utils.dotdict import dotdict
|
|
from rocprofiler_sdk.pytest_utils import collapse_dict_list
|
|
from rocprofiler_sdk.pytest_utils.perfetto_reader import PerfettoReader
|
|
|
|
|
|
def pytest_addoption(parser):
|
|
parser.addoption(
|
|
"--hsa-trace-input",
|
|
action="store",
|
|
help="Path to HSA API tracing CSV file.",
|
|
)
|
|
parser.addoption(
|
|
"--kernel-trace-input",
|
|
action="store",
|
|
help="Path to Kernel API tracing CSV file.",
|
|
)
|
|
parser.addoption(
|
|
"--json-input",
|
|
action="store",
|
|
help="Path to JSON file.",
|
|
)
|
|
parser.addoption(
|
|
"--pftrace-input",
|
|
action="store",
|
|
help="Path to Perfetto trace file.",
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def hsa_trace_input_data(request):
|
|
filename = request.config.getoption("--hsa-trace-input")
|
|
data = []
|
|
with open(filename, "r") as inp:
|
|
reader = csv.DictReader(inp)
|
|
for row in reader:
|
|
data.append(row)
|
|
|
|
return data
|
|
|
|
|
|
@pytest.fixture
|
|
def kernel_trace_input_data(request):
|
|
filename = request.config.getoption("--kernel-trace-input")
|
|
data = []
|
|
with open(filename, "r") as inp:
|
|
reader = csv.DictReader(inp)
|
|
for row in reader:
|
|
data.append(row)
|
|
|
|
return data
|
|
|
|
|
|
@pytest.fixture
|
|
def json_data(request):
|
|
filename = request.config.getoption("--json-input")
|
|
with open(filename, "r") as inp:
|
|
return dotdict(collapse_dict_list(json.load(inp)))
|
|
|
|
|
|
@pytest.fixture
|
|
def pftrace_data(request):
|
|
filename = request.config.getoption("--pftrace-input")
|
|
return PerfettoReader(filename).read()[0]
|