summaryrefslogtreecommitdiffstats
path: root/include/framework/scheduling/statistics.h
diff options
context:
space:
mode:
authorDouglas B. Rumbaugh <dbr4@psu.edu>2024-12-06 13:13:51 -0500
committerGitHub <noreply@github.com>2024-12-06 18:13:51 +0000
commit9fe305c7d28e993e55c55427f377ae7e3251ea4f (patch)
tree384b687f64b84eb81bde2becac8a5f24916b07b4 /include/framework/scheduling/statistics.h
parent47916da2ba5ed5bee2dda3cbcc58d39e1e931bfc (diff)
downloaddynamic-extension-9fe305c7d28e993e55c55427f377ae7e3251ea4f.tar.gz
Interface update (#5)
* Query Interface Adjustments/Refactoring Began the process of adjusting the query interface (and also the shard interface, to a lesser degree) to better accommodate the user. In particular the following changes have been made, 1. The number of necessary template arguments for the query type has been drastically reduced, while also removing the void pointers and manual delete functions from the interface. This was accomplished by requiring many of the sub-types associated with a query (parameters, etc.) to be nested inside the main query class, and by forcing the SHARD type to expose its associated record type. 2. User-defined query return types are now supported. Queries no longer are required to return strictly sets of records. Instead, the query now has LocalResultType and ResultType template parameters (which can be defaulted using a typedef in the Query type itself), allowing much more flexibility. Note that, at least for the short term, the LocalResultType must still expose the same is_deleted/is_tombstone interface as a Wrapped<R> used to, as this is currently needed for delete filtering. A better approach to this is, hopefully, forthcoming. 3. Updated the ISAMTree.h shard and rangequery.h query to use the new interfaces, and adjusted the associated unit tests as well. 4. Dropped the unnecessary "get_data()" function from the ShardInterface concept. 5. Dropped the need to specify a record type in the ShardInterface concept. This is now handled using a required Shard::RECORD member of the Shard class itself, which should expose the name of the record type. * Updates to framework to support new Query/Shard interfaces Pretty extensive adjustments to the framework, particularly to the templates themselves, along with some type-renaming work, to support the new query and shard interfaces. Adjusted the external query interface to take an rvalue reference, rather than a pointer, to the query parameters. * Removed framework-level delete filtering This was causing some issues with the new query interface, and should probably be reworked anyway, so I'm temporarily (TM) removing the feature. * Updated benchmarks + remaining code for new interface
Diffstat (limited to 'include/framework/scheduling/statistics.h')
-rw-r--r--include/framework/scheduling/statistics.h140
1 files changed, 64 insertions, 76 deletions
diff --git a/include/framework/scheduling/statistics.h b/include/framework/scheduling/statistics.h
index 6c479cd..48c186f 100644
--- a/include/framework/scheduling/statistics.h
+++ b/include/framework/scheduling/statistics.h
@@ -1,7 +1,7 @@
/*
* include/framework/scheduling/statistics.h
*
- * Copyright (C) 2023 Douglas B. Rumbaugh <drumbaugh@psu.edu>
+ * Copyright (C) 2023-2024 Douglas B. Rumbaugh <drumbaugh@psu.edu>
*
* Distributed under the Modified BSD License.
*
@@ -13,106 +13,94 @@
*/
#pragma once
-#include <cstdlib>
+#include <atomic>
#include <cassert>
+#include <chrono>
+#include <cstdlib>
+#include <mutex>
#include <unordered_map>
#include <vector>
-#include <mutex>
-#include <chrono>
-#include <atomic>
namespace de {
class SchedulerStatistics {
private:
- enum class EventType {
- QUEUED,
- SCHEDULED,
- STARTED,
- FINISHED
- };
+ enum class EventType { QUEUED, SCHEDULED, STARTED, FINISHED };
- struct Event {
- size_t id;
- EventType type;
- };
-
- struct JobInfo {
- size_t id;
- size_t size;
- size_t type;
- };
+ struct Event {
+ size_t id;
+ EventType type;
+ };
+ struct JobInfo {
+ size_t id;
+ size_t size;
+ size_t type;
+ };
public:
- SchedulerStatistics() = default;
- ~SchedulerStatistics() = default;
+ SchedulerStatistics() = default;
+ ~SchedulerStatistics() = default;
- void job_queued(size_t id, size_t type, size_t size) {
- auto time = std::chrono::high_resolution_clock::now();
- }
+ void job_queued(size_t id, size_t type, size_t size) { }
- void job_scheduled(size_t id) {
- std::unique_lock<std::mutex> lk(m_mutex);
+ void job_scheduled(size_t id) { std::unique_lock<std::mutex> lk(m_mutex); }
- }
+ void job_begin(size_t id) {}
- void job_begin(size_t id) {
+ void job_complete(size_t id) {}
- }
+ /* FIXME: This is just a temporary approach */
+ void log_time_data(size_t length, size_t type) {
+ assert(type == 1 || type == 2);
- void job_complete(size_t id) {
+ if (type == 1) {
+ m_type_1_cnt.fetch_add(1);
+ m_type_1_total_time.fetch_add(length);
- }
+ if (length > m_type_1_largest_time) {
+ m_type_1_largest_time.store(length);
+ }
+ } else {
+ m_type_2_cnt.fetch_add(1);
+ m_type_2_total_time.fetch_add(length);
- /* FIXME: This is just a temporary approach */
- void log_time_data(size_t length, size_t type) {
- assert(type == 1 || type == 2);
-
- if (type == 1) {
- m_type_1_cnt.fetch_add(1);
- m_type_1_total_time.fetch_add(length);
-
- if (length > m_type_1_largest_time) {
- m_type_1_largest_time.store(length);
- }
- } else {
- m_type_2_cnt.fetch_add(1);
- m_type_2_total_time.fetch_add(length);
-
- if (length > m_type_2_largest_time) {
- m_type_2_largest_time.store(length);
- }
- }
+ if (length > m_type_2_largest_time) {
+ m_type_2_largest_time.store(length);
+ }
}
-
- void print_statistics() {
- if (m_type_1_cnt > 0) {
- fprintf(stdout, "Query Count: %ld\tQuery Avg. Latency: %ld\tMax Query Latency: %ld\n",
- m_type_1_cnt.load(),
- m_type_1_total_time.load() / m_type_1_cnt.load(),
- m_type_1_largest_time.load());
- }
- if (m_type_2_cnt > 0) {
- fprintf(stdout, "Reconstruction Count: %ld\tReconstruction Avg. Latency: %ld\tMax Recon. Latency:%ld\n",
- m_type_2_cnt.load(),
- m_type_2_total_time.load() / m_type_2_cnt.load(),
- m_type_2_largest_time.load());
- }
+ }
+
+ void print_statistics() {
+ if (m_type_1_cnt > 0) {
+ fprintf(
+ stdout,
+ "Query Count: %ld\tQuery Avg. Latency: %ld\tMax Query Latency: %ld\n",
+ m_type_1_cnt.load(), m_type_1_total_time.load() / m_type_1_cnt.load(),
+ m_type_1_largest_time.load());
+ }
+ if (m_type_2_cnt > 0) {
+ fprintf(stdout,
+ "Reconstruction Count: %ld\tReconstruction Avg. Latency: "
+ "%ld\tMax Recon. Latency:%ld\n",
+ m_type_2_cnt.load(),
+ m_type_2_total_time.load() / m_type_2_cnt.load(),
+ m_type_2_largest_time.load());
}
+ }
private:
- std::mutex m_mutex;
- std::unordered_map<size_t, JobInfo> m_jobs;
- std::vector<Event> m_event_log;
+ std::mutex m_mutex;
+ std::unordered_map<size_t, JobInfo> m_jobs;
+ std::vector<Event> m_event_log;
- std::atomic<size_t> m_type_1_cnt;
- std::atomic<size_t> m_type_1_total_time;
+ std::atomic<size_t> m_type_1_cnt;
+ std::atomic<size_t> m_type_1_total_time;
- std::atomic<size_t> m_type_2_cnt;
- std::atomic<size_t> m_type_2_total_time;
+ std::atomic<size_t> m_type_2_cnt;
+ std::atomic<size_t> m_type_2_total_time;
- std::atomic<size_t> m_type_1_largest_time;
- std::atomic<size_t> m_type_2_largest_time;
+ std::atomic<size_t> m_type_1_largest_time;
+ std::atomic<size_t> m_type_2_largest_time;
};
-}
+} // namespace de