From aa15300f8302bf713d752a775f32060b59b8746f Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Wed, 30 Apr 2025 13:06:56 -0400 Subject: Stats tweaks and KNN benchmark --- include/framework/scheduling/FIFOScheduler.h | 1 + include/framework/scheduling/SerialScheduler.h | 1 + include/framework/scheduling/statistics.h | 11 ++++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'include/framework/scheduling') diff --git a/include/framework/scheduling/FIFOScheduler.h b/include/framework/scheduling/FIFOScheduler.h index 2f49b5f..8fbe07c 100644 --- a/include/framework/scheduling/FIFOScheduler.h +++ b/include/framework/scheduling/FIFOScheduler.h @@ -36,6 +36,7 @@ public: m_thrd_cnt((thread_cnt) ? thread_cnt : DEFAULT_MAX_THREADS), m_used_memory(0), m_used_thrds(0), m_shutdown(false) { m_sched_thrd = std::thread(&FIFOScheduler::run, this); + m_counter.store(0); m_thrd_pool.resize(m_thrd_cnt); } diff --git a/include/framework/scheduling/SerialScheduler.h b/include/framework/scheduling/SerialScheduler.h index 7cd9cfc..b6ebe53 100644 --- a/include/framework/scheduling/SerialScheduler.h +++ b/include/framework/scheduling/SerialScheduler.h @@ -40,6 +40,7 @@ public: void shutdown() { /* intentionally left blank */ } void print_statistics() { m_stats.print_statistics(); } + void print_query_time_data() { m_stats.print_query_time_data(); } private: [[maybe_unused]] size_t m_memory_budget; diff --git a/include/framework/scheduling/statistics.h b/include/framework/scheduling/statistics.h index 304a0c4..34699f1 100644 --- a/include/framework/scheduling/statistics.h +++ b/include/framework/scheduling/statistics.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -113,6 +114,9 @@ public: int64_t query_cnt = 0; + size_t worst_query = 0; + size_t first_query = UINT64_MAX; + /* hard-coded for the moment to only consider queries */ for (auto &job : m_jobs) { @@ -120,6 +124,10 @@ public: continue; } + if (job.first < first_query) { + first_query = job.first; + } + total_queue_time += job.second.time_in_queue(); total_runtime += job.second.runtime(); @@ -133,6 +141,7 @@ public: if (job.second.runtime() > max_runtime) { max_runtime = job.second.runtime(); + worst_query = job.first; } if (job.second.runtime() < min_runtime) { @@ -163,7 +172,7 @@ public: int64_t runtime_stddev = std::sqrt(runtime_deviation_sum / query_cnt); - fprintf(stdout, "Query Count: %ld\n", query_cnt); + fprintf(stdout, "Query Count: %ld\tWorst Query: %ld\tFirst Query: %ld\n", query_cnt, worst_query, first_query); fprintf(stdout, "Average Query Scheduling Delay: %ld\t Min Scheduling Delay: %ld\t Max Scheduling Delay: %ld\tStandard Deviation: %ld\n", average_queue_time, min_queue_time, max_queue_time, queue_stddev); fprintf(stdout, "Average Query Latency: %ld\t\t Min Query Latency: %ld\t Max Query Latency: %ld\tStandard Deviation: %ld\n", average_runtime, min_runtime, max_runtime, runtime_stddev); } -- cgit v1.2.3