Skip to content

Commit

Permalink
Plumb file path to reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
debermudez committed Aug 2, 2023
1 parent 3162c65 commit 9cfcbd2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
11 changes: 11 additions & 0 deletions src/c++/perf_analyzer/perf_analyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ PerfAnalyzer::Run()
PrerunReport();
Profile();
WriteReport();
GenerateProfileExportReport();
Finalize();
}

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -426,6 +431,12 @@ PerfAnalyzer::WriteReport()
writer->GenerateReport();
}

void
PerfAnalyzer::GenerateProfileExportReport()
{
reporter_->OutputToFile(params_->profile_export_file);
}

void
PerfAnalyzer::Finalize()
{
Expand Down
3 changes: 3 additions & 0 deletions src/c++/perf_analyzer/perf_analyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -184,6 +185,7 @@ class PerfAnalyzer {
std::shared_ptr<pa::ModelParser> parser_;
std::vector<pa::PerfStatus> perf_statuses_;
std::shared_ptr<pa::RawDataCollector> collector_;
std::shared_ptr<pa::RawDataReporter> reporter_;

//
// Helper methods
Expand All @@ -195,5 +197,6 @@ class PerfAnalyzer {
void PrerunReport();
void Profile();
void WriteReport();
void GenerateProfileExportReport();
void Finalize();
};
12 changes: 2 additions & 10 deletions src/c++/perf_analyzer/raw_data_reporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));

Expand Down
2 changes: 1 addition & 1 deletion src/c++/perf_analyzer/raw_data_reporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class RawDataReporter {
/// Output to stdout
void Print();

void OutputToFile();
void OutputToFile(std::string& file_path);

private:
RawDataReporter() = default;
Expand Down

0 comments on commit 9cfcbd2

Please sign in to comment.