Initial commit
This commit is contained in:
44
dram_tracer_launcher.cpp
Normal file
44
dram_tracer_launcher.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#include "dram_tracer_create.h"
|
||||
|
||||
#include <dr_frontend.h>
|
||||
#include <drmemtrace/analyzer.h>
|
||||
#include <drmemtrace/histogram_create.h>
|
||||
#include <droption.h>
|
||||
#include <fmt/core.h>
|
||||
#include <iostream>
|
||||
|
||||
static droption_t<std::string>
|
||||
op_trace_dir(DROPTION_SCOPE_FRONTEND, "trace_dir", "", "[Required] Trace input directory",
|
||||
"Specifies the directory containing the trace files to be analyzed.");
|
||||
|
||||
static droption_t<std::string>
|
||||
op_output_dir(DROPTION_SCOPE_FRONTEND, "output_dir", "", "Trace output directory",
|
||||
"Specifies the directory of the trace files to output.");
|
||||
|
||||
int _tmain(int argc, const TCHAR *targv[])
|
||||
{
|
||||
// Convert to UTF-8 if necessary
|
||||
char **argv;
|
||||
drfront_status_t sc = drfront_convert_args(targv, &argv, argc);
|
||||
if (sc != DRFRONT_SUCCESS) {
|
||||
fmt::print("Failed to process args: {}", sc);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
std::string parse_err;
|
||||
if (!droption_parser_t::parse_argv(DROPTION_SCOPE_FRONTEND, argc, (const char **)argv, &parse_err, NULL) ||
|
||||
op_trace_dir.get_value().empty()) {
|
||||
fmt::print("Usage error: {}\nUsage:\n{}", parse_err.c_str(),
|
||||
droption_parser_t::usage_short(DROPTION_SCOPE_ALL).c_str());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
std::array<analysis_tool_t *, 1> tools{dram_tracer_create(op_output_dir.get_value())};
|
||||
|
||||
analyzer_t analyzer(op_trace_dir.get_value(), tools.data(), (int)tools.size());
|
||||
analyzer.run();
|
||||
analyzer.print_stats();
|
||||
|
||||
for (auto tool : tools)
|
||||
delete tool;
|
||||
}
|
||||
Reference in New Issue
Block a user