-
Notifications
You must be signed in to change notification settings - Fork 55
/
tool.cc
58 lines (45 loc) · 1.42 KB
/
tool.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//==============================================================
// Copyright (C) Intel Corporation
//
// SPDX-License-Identifier: MIT
// =============================================================
#include "gpu_perfmon_collector.h"
static GpuPerfMonCollector* collector = nullptr;
// External Tool Interface ////////////////////////////////////////////////////
extern "C" PTI_EXPORT
void Usage() {
std::cout <<
"Usage: ./gpu_perfmon_read[.exe] <application> <args>" <<
std::endl;
}
extern "C" PTI_EXPORT
int ParseArgs(int argc, char* argv[]) {
return 1;
}
extern "C" PTI_EXPORT
void SetToolEnv() {
utils::SetEnv("ZET_ENABLE_API_TRACING_EXP", "1");
utils::SetEnv("ZET_ENABLE_PROGRAM_INSTRUMENTATION", "1");
}
// Internal Tool Functionality ////////////////////////////////////////////////
static void PrintResults() {
PTI_ASSERT(collector != nullptr);
const KernelDataMap& kernel_data_map = collector->GetKernelDataMap();
if (kernel_data_map.size() == 0) {
std::cerr << "[WARNING] No kernels were collected" << std::endl;
return;
}
std::cerr << std::endl;
GpuPerfMonCollector::PrintResults(kernel_data_map);
}
// Internal Tool Interface ////////////////////////////////////////////////////
void EnableProfiling() {
PTI_ASSERT(collector == nullptr);
collector = GpuPerfMonCollector::Create();
}
void DisableProfiling() {
if (collector != nullptr) {
PrintResults();
delete collector;
}
}