diff --git a/src/c++/perf_analyzer/perf_analyzer.cc b/src/c++/perf_analyzer/perf_analyzer.cc index 6b392d6cc..9d837df6f 100644 --- a/src/c++/perf_analyzer/perf_analyzer.cc +++ b/src/c++/perf_analyzer/perf_analyzer.cc @@ -64,6 +64,7 @@ PerfAnalyzer::Run() PrerunReport(); Profile(); WriteReport(); + GenerateProfileExportReport(); Finalize(); } @@ -257,6 +258,10 @@ PerfAnalyzer::CreateAnalyzerObjects() pa::RawDataCollector::Create(&collector_), "failed to create data collector"); + FAIL_IF_ERR( + pa::RawDataReporter::Create(&reporter_), + "failed to create data reporter"); + FAIL_IF_ERR( pa::InferenceProfiler::Create( params_->verbose, params_->stability_threshold, @@ -426,6 +431,12 @@ PerfAnalyzer::WriteReport() writer->GenerateReport(); } +void +PerfAnalyzer::GenerateProfileExportReport() +{ + reporter_->OutputToFile(params_->profile_export_file); +} + void PerfAnalyzer::Finalize() { diff --git a/src/c++/perf_analyzer/perf_analyzer.h b/src/c++/perf_analyzer/perf_analyzer.h index 8d26a48fc..29ccef409 100644 --- a/src/c++/perf_analyzer/perf_analyzer.h +++ b/src/c++/perf_analyzer/perf_analyzer.h @@ -38,6 +38,7 @@ #include "mpi_utils.h" #include "perf_utils.h" #include "raw_data_collector.h" +#include "raw_data_reporter.h" // Perf Analyzer provides various metrics to measure the performance of // the inference server. It can either be used to measure the throughput, @@ -184,6 +185,7 @@ class PerfAnalyzer { std::shared_ptr parser_; std::vector perf_statuses_; std::shared_ptr collector_; + std::shared_ptr reporter_; // // Helper methods @@ -195,5 +197,6 @@ class PerfAnalyzer { void PrerunReport(); void Profile(); void WriteReport(); + void GenerateProfileExportReport(); void Finalize(); }; diff --git a/src/c++/perf_analyzer/raw_data_reporter.cc b/src/c++/perf_analyzer/raw_data_reporter.cc index 854cdc3cc..3ba295caa 100644 --- a/src/c++/perf_analyzer/raw_data_reporter.cc +++ b/src/c++/perf_analyzer/raw_data_reporter.cc @@ -52,14 +52,6 @@ RawDataReporter::ConvertToJson( ClearDocument(); Value experiments(kArrayType); - - // iterate over the json - // create experiments object - // create version object - // create experiment object -- new method? - // create requests array -- new method? - // create window boundary -- new method? - for (const auto& raw_experiment : raw_experiments) { Value experiment(kObjectType); Value requests(kArrayType); @@ -158,9 +150,9 @@ RawDataReporter::Print() } void -RawDataReporter::OutputToFile() +RawDataReporter::OutputToFile(std::string& file_path) { - FILE* fp = fopen("fix_me", "w"); + FILE* fp = fopen(file_path.c_str(), "w"); char writeBuffer[65536]; FileWriteStream os(fp, writeBuffer, sizeof(writeBuffer)); diff --git a/src/c++/perf_analyzer/raw_data_reporter.h b/src/c++/perf_analyzer/raw_data_reporter.h index 99aa8a283..2a81bac65 100644 --- a/src/c++/perf_analyzer/raw_data_reporter.h +++ b/src/c++/perf_analyzer/raw_data_reporter.h @@ -50,7 +50,7 @@ class RawDataReporter { /// Output to stdout void Print(); - void OutputToFile(); + void OutputToFile(std::string& file_path); private: RawDataReporter() = default;