diff --git a/src/c++/perf_analyzer/inference_profiler.cc b/src/c++/perf_analyzer/inference_profiler.cc index 9fca738bc..655abcd32 100644 --- a/src/c++/perf_analyzer/inference_profiler.cc +++ b/src/c++/perf_analyzer/inference_profiler.cc @@ -637,9 +637,9 @@ InferenceProfiler::ProfileHelper( } } - *is_stable = determineStability(load_status); + *is_stable = DetermineStability(load_status); - if (isDoneProfiling(load_status, is_stable)) { + if (IsDoneProfiling(load_status, is_stable)) { break; } @@ -665,7 +665,7 @@ InferenceProfiler::ProfileHelper( } bool -InferenceProfiler::determineStability(LoadStatus& load_status) +InferenceProfiler::DetermineStability(LoadStatus& load_status) { bool stable = false; if (load_status.infer_per_sec.size() >= load_parameters_.stability_window) { @@ -679,20 +679,20 @@ InferenceProfiler::determineStability(LoadStatus& load_status) } } - stable = stable && checkWindowForStability(idx, load_status); + stable = stable && CheckWindowForStability(idx, load_status); } return stable; } bool -InferenceProfiler::checkWindowForStability(size_t idx, LoadStatus& load_status) +InferenceProfiler::CheckWindowForStability(size_t idx, LoadStatus& load_status) { - return isInferWindowStable(idx, load_status) && - isLatencyWindowStable(idx, load_status); + return IsInferWindowStable(idx, load_status) && + IsLatencyWindowStable(idx, load_status); } bool -InferenceProfiler::isInferWindowStable(size_t idx, LoadStatus& load_status) +InferenceProfiler::IsInferWindowStable(size_t idx, LoadStatus& load_status) { auto infer_start = std::begin(load_status.infer_per_sec) + idx; auto infer_per_sec_measurements = std::minmax_element( @@ -706,7 +706,7 @@ InferenceProfiler::isInferWindowStable(size_t idx, LoadStatus& load_status) } bool -InferenceProfiler::isLatencyWindowStable(size_t idx, LoadStatus& load_status) +InferenceProfiler::IsLatencyWindowStable(size_t idx, LoadStatus& load_status) { auto latency_start = std::begin(load_status.latencies) + idx; auto latencies_per_sec_measurements = std::minmax_element( @@ -719,7 +719,7 @@ InferenceProfiler::isLatencyWindowStable(size_t idx, LoadStatus& load_status) } bool -InferenceProfiler::isDoneProfiling(LoadStatus& load_status, bool* is_stable) +InferenceProfiler::IsDoneProfiling(LoadStatus& load_status, bool* is_stable) { size_t idx = load_status.infer_per_sec.size() - load_parameters_.stability_window; @@ -727,7 +727,7 @@ InferenceProfiler::isDoneProfiling(LoadStatus& load_status, bool* is_stable) bool done = false; for (size_t i = idx; i < load_status.infer_per_sec.size(); i++) { - within_threshold &= checkWithinThreshold(idx, load_status); + within_threshold &= CheckWithinThreshold(idx, load_status); } if (mpi_driver_->IsMPIRun()) { @@ -744,7 +744,7 @@ InferenceProfiler::isDoneProfiling(LoadStatus& load_status, bool* is_stable) } bool -InferenceProfiler::checkWithinThreshold(size_t idx, LoadStatus& load_status) +InferenceProfiler::CheckWithinThreshold(size_t idx, LoadStatus& load_status) { return load_status.latencies[idx] < (latency_threshold_ms_ * 1000 * 1000); } @@ -1387,17 +1387,17 @@ class TestInferenceProfiler { } - static bool testCheckWithinThreshold( + static bool TestCheckWithinThreshold( LoadStatus& ls, LoadParams& lp, uint64_t latency_threshold_ms) { InferenceProfiler ip; size_t idx = ls.infer_per_sec.size() - lp.stability_window; ip.latency_threshold_ms_ = latency_threshold_ms; - return ip.checkWithinThreshold(idx, ls); + return ip.CheckWithinThreshold(idx, ls); } - static bool testCheckWindowForStability(LoadStatus& ls, LoadParams& lp) + static bool TestCheckWindowForStability(LoadStatus& ls, LoadParams& lp) { size_t idx = ls.infer_per_sec.size() - lp.stability_window; @@ -1405,19 +1405,19 @@ class TestInferenceProfiler { ip.load_parameters_.stability_threshold = lp.stability_threshold; ip.load_parameters_.stability_window = lp.stability_window; - return ip.checkWindowForStability(idx, ls); + return ip.CheckWindowForStability(idx, ls); }; - static bool testDetermineStability(LoadStatus& ls, LoadParams& lp) + static bool TestDetermineStability(LoadStatus& ls, LoadParams& lp) { InferenceProfiler ip; ip.load_parameters_.stability_threshold = lp.stability_threshold; ip.load_parameters_.stability_window = lp.stability_window; - return ip.determineStability(ls); + return ip.DetermineStability(ls); } - static bool testIsDoneProfiling( + static bool TestIsDoneProfiling( LoadStatus& ls, LoadParams& lp, uint64_t latency_threshold_ms) { InferenceProfiler ip; @@ -1426,8 +1426,8 @@ class TestInferenceProfiler { ip.latency_threshold_ms_ = latency_threshold_ms; ip.mpi_driver_ = std::make_shared(false); - bool is_stable = ip.determineStability(ls); - return ip.isDoneProfiling(ls, &is_stable); + bool is_stable = ip.DetermineStability(ls); + return ip.IsDoneProfiling(ls, &is_stable); }; }; @@ -1491,7 +1491,7 @@ TEST_CASE("test_check_window_for_stability") ls.latencies = {1, 1, 1}; lp.stability_window = 3; lp.stability_threshold = 0.1; - CHECK(TestInferenceProfiler::testCheckWindowForStability(ls, lp) == false); + CHECK(TestInferenceProfiler::TestCheckWindowForStability(ls, lp) == false); } SUBCASE("test throughput stable") { @@ -1499,7 +1499,7 @@ TEST_CASE("test_check_window_for_stability") ls.latencies = {1, 1, 1}; lp.stability_window = 3; lp.stability_threshold = 0.1; - CHECK(TestInferenceProfiler::testCheckWindowForStability(ls, lp) == true); + CHECK(TestInferenceProfiler::TestCheckWindowForStability(ls, lp) == true); } SUBCASE("test latency not stable") { @@ -1507,7 +1507,7 @@ TEST_CASE("test_check_window_for_stability") ls.latencies = {1, 100, 50}; lp.stability_window = 3; lp.stability_threshold = 0.1; - CHECK(TestInferenceProfiler::testCheckWindowForStability(ls, lp) == false); + CHECK(TestInferenceProfiler::TestCheckWindowForStability(ls, lp) == false); } SUBCASE("test latency stable") { @@ -1515,7 +1515,7 @@ TEST_CASE("test_check_window_for_stability") ls.latencies = {45, 50, 45}; lp.stability_window = 3; lp.stability_threshold = 0.1; - CHECK(TestInferenceProfiler::testCheckWindowForStability(ls, lp) == true); + CHECK(TestInferenceProfiler::TestCheckWindowForStability(ls, lp) == true); } SUBCASE("test throughput stable after many measurements") { @@ -1523,7 +1523,7 @@ TEST_CASE("test_check_window_for_stability") ls.latencies = {1, 1, 1, 1, 1, 1, 1}; lp.stability_window = 3; lp.stability_threshold = 0.1; - CHECK(TestInferenceProfiler::testCheckWindowForStability(ls, lp) == true); + CHECK(TestInferenceProfiler::TestCheckWindowForStability(ls, lp) == true); } } @@ -1541,7 +1541,7 @@ TEST_CASE("test check within threshold") { ls.latencies = {2000000, 2000000, 2000000}; CHECK( - TestInferenceProfiler::testCheckWithinThreshold( + TestInferenceProfiler::TestCheckWithinThreshold( ls, lp, latency_threshold_ms) == false); } @@ -1549,7 +1549,7 @@ TEST_CASE("test check within threshold") { ls.latencies = {100000, 100000, 100000}; CHECK( - TestInferenceProfiler::testCheckWithinThreshold( + TestInferenceProfiler::TestCheckWithinThreshold( ls, lp, latency_threshold_ms) == true); } } @@ -1566,10 +1566,10 @@ TEST_CASE("test_determine_stability") lp.stability_window = 3; lp.stability_threshold = 0.1; uint64_t latency_threshold_ms = 1; - CHECK(TestInferenceProfiler::testDetermineStability(ls, lp) == false); + CHECK(TestInferenceProfiler::TestDetermineStability(ls, lp) == false); ls.infer_per_sec = {500.0, 520.0, 510.0}; - CHECK(TestInferenceProfiler::testDetermineStability(ls, lp) == true); + CHECK(TestInferenceProfiler::TestDetermineStability(ls, lp) == true); } } @@ -1588,7 +1588,7 @@ TEST_CASE("test_is_done_profiling") uint64_t latency_threshold_ms = NO_LIMIT; CHECK( - TestInferenceProfiler::testIsDoneProfiling( + TestInferenceProfiler::TestIsDoneProfiling( ls, lp, latency_threshold_ms) == false); } @@ -1601,7 +1601,7 @@ TEST_CASE("test_is_done_profiling") uint64_t latency_threshold_ms = NO_LIMIT; CHECK( - TestInferenceProfiler::testIsDoneProfiling( + TestInferenceProfiler::TestIsDoneProfiling( ls, lp, latency_threshold_ms) == false); } @@ -1614,7 +1614,7 @@ TEST_CASE("test_is_done_profiling") lp.stability_threshold = 0.1; uint64_t latency_threshold_ms = 1; CHECK( - TestInferenceProfiler::testIsDoneProfiling( + TestInferenceProfiler::TestIsDoneProfiling( ls, lp, latency_threshold_ms) == true); } @@ -1627,12 +1627,12 @@ TEST_CASE("test_is_done_profiling") uint64_t latency_threshold_ms = 1; CHECK( - TestInferenceProfiler::testIsDoneProfiling( + TestInferenceProfiler::TestIsDoneProfiling( ls, lp, latency_threshold_ms) == false); ls.infer_per_sec = {500.0, 520.0, 510.0}; CHECK( - TestInferenceProfiler::testIsDoneProfiling( + TestInferenceProfiler::TestIsDoneProfiling( ls, lp, latency_threshold_ms) == true); } } diff --git a/src/c++/perf_analyzer/inference_profiler.h b/src/c++/perf_analyzer/inference_profiler.h index 0aae3b7ec..001272132 100644 --- a/src/c++/perf_analyzer/inference_profiler.h +++ b/src/c++/perf_analyzer/inference_profiler.h @@ -337,41 +337,41 @@ class InferenceProfiler { /// A helper function to determine if profiling is stable /// \param load_status Stores the observations of infer_per_sec and latencies /// \return Returns if the threshold and latencies are stable. - bool determineStability(LoadStatus& load_status); + bool DetermineStability(LoadStatus& load_status); /// Check if latency at index idx is within the latency threshold /// \param idx index in latency vector /// \param load_status Stores the observations of infer_per_sec and latencies /// \return Returns whether the latencies are below the max threshold - bool checkWithinThreshold(size_t idx, LoadStatus& load_status); + bool CheckWithinThreshold(size_t idx, LoadStatus& load_status); /// A helper function to determine if profiling is done /// \param load_status Stores the observations of infer_per_sec and latencies /// \param is_stable Returns whether the measurement stabilized or not. /// \return Returns if we should break out of the infinite stability check /// loop. - bool isDoneProfiling(LoadStatus& load_status, bool* is_stable); + bool IsDoneProfiling(LoadStatus& load_status, bool* is_stable); /// Check if observed inferences and latencies are within threshold /// for a single window starting at idx /// \param idx index in latency vector /// \param load_status Stores the observations of infer_per_sec and latencies /// \return Returns whether inference and latency are stable - bool checkWindowForStability(size_t idx, LoadStatus& load_status); + bool CheckWindowForStability(size_t idx, LoadStatus& load_status); /// Check if observed inferences are within threshold /// for a single window starting at idx /// \param idx index in latency vector /// \param load_status Stores the observations of infer_per_sec and latencies /// \return Returns whether inference is stable - bool isInferWindowStable(size_t idx, LoadStatus& load_status); + bool IsInferWindowStable(size_t idx, LoadStatus& load_status); /// Check if observed latencies are within threshold /// for a single window starting at idx /// \param idx index in latency vector /// \param load_status Stores the observations of infer_per_sec and latencies /// \return Returns whether latency is stable - bool isLatencyWindowStable(size_t idx, LoadStatus& load_status); + bool IsLatencyWindowStable(size_t idx, LoadStatus& load_status); /// Helper function to perform measurement. /// \param status_summary The summary of this measurement.