Skip to content

Commit 81df0d6

Browse files
Delete ringbuffer LoadMonitor (#7528)
Co-authored-by: Amaury Chamayou <amchamay@microsoft.com>
1 parent 572ee59 commit 81df0d6

6 files changed

Lines changed: 0 additions & 169 deletions

File tree

src/ds/messaging.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ namespace messaging
4646
std::map<MessageType, Handler> handlers;
4747
std::map<MessageType, char const*> message_labels;
4848

49-
MessageCounts message_counts;
50-
5149
std::string get_error_prefix()
5250
{
5351
return std::string("[") + std::string(name) + std::string("] ");
@@ -174,28 +172,6 @@ namespace messaging
174172
LOG_TRACE_FMT("{}", e.what());
175173
throw e;
176174
}
177-
178-
auto& counts = message_counts[m];
179-
counts.messages++;
180-
counts.bytes += size;
181-
}
182-
183-
MessageCounts retrieve_message_counts()
184-
{
185-
MessageCounts current;
186-
std::swap(message_counts, current);
187-
return current;
188-
}
189-
190-
nlohmann::json convert_message_counts(const MessageCounts& mc)
191-
{
192-
auto j = nlohmann::json::object();
193-
for (const auto& it : mc)
194-
{
195-
j[get_message_name(it.first)] = {
196-
{"count", it.second.messages}, {"bytes", it.second.bytes}};
197-
}
198-
return j;
199175
}
200176
};
201177

src/ds/test/messaging.cpp

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -198,21 +198,12 @@ TEST_CASE("Basic message loop" * doctest::test_suite("messaging"))
198198
{
199199
test_filler.write(echo_out);
200200
REQUIRE_THROWS_AS(bp.run(loop_src), messaging::no_handler);
201-
202-
const auto counts = bp.get_dispatcher().retrieve_message_counts();
203-
REQUIRE(counts.empty());
204201
}
205202

206203
SUBCASE("Message handlers can finish the loop")
207204
{
208205
test_filler.write(finish);
209206
REQUIRE(bp.run(loop_src) == 1);
210-
211-
const auto counts = bp.get_dispatcher().retrieve_message_counts();
212-
REQUIRE(counts.size() == 1);
213-
REQUIRE(counts.find(finish) != counts.end());
214-
REQUIRE(counts.at(finish).messages == 1);
215-
REQUIRE(counts.at(finish).bytes == 0);
216207
}
217208

218209
SUBCASE("Message handlers can affect external state")
@@ -222,15 +213,6 @@ TEST_CASE("Basic message loop" * doctest::test_suite("messaging"))
222213
test_filler.write(finish);
223214
REQUIRE(bp.run(loop_src) == 2);
224215
REQUIRE(x == new_x);
225-
226-
const auto counts = bp.get_dispatcher().retrieve_message_counts();
227-
REQUIRE(counts.size() == 2);
228-
REQUIRE(counts.find(set_x) != counts.end());
229-
REQUIRE(counts.at(set_x).messages == 1);
230-
REQUIRE(counts.at(set_x).bytes == sizeof(new_x));
231-
REQUIRE(counts.find(finish) != counts.end());
232-
REQUIRE(counts.at(finish).messages == 1);
233-
REQUIRE(counts.at(finish).bytes == 0);
234216
}
235217

236218
SUBCASE("Message handlers can communicate through the writer")
@@ -250,15 +232,6 @@ TEST_CASE("Basic message loop" * doctest::test_suite("messaging"))
250232
REQUIRE(data[i] == actual[i]);
251233
}
252234
}) == 1);
253-
254-
const auto counts = bp.get_dispatcher().retrieve_message_counts();
255-
REQUIRE(counts.size() == 2);
256-
REQUIRE(counts.find(echo) != counts.end());
257-
REQUIRE(counts.at(echo).messages == 1);
258-
REQUIRE(counts.at(echo).bytes == actual.size());
259-
REQUIRE(counts.find(finish) != counts.end());
260-
REQUIRE(counts.at(finish).messages == 1);
261-
REQUIRE(counts.at(finish).bytes == 0);
262235
}
263236

264237
SUBCASE("Dispatcher can be accessed directly")
@@ -280,12 +253,6 @@ TEST_CASE("Basic message loop" * doctest::test_suite("messaging"))
280253
dispatcher.remove_message_handler(set_x), messaging::no_handler);
281254
REQUIRE_THROWS_AS(
282255
dispatcher.dispatch(set_x, nullptr, 0), messaging::no_handler);
283-
284-
const auto counts = bp.get_dispatcher().retrieve_message_counts();
285-
REQUIRE(counts.size() == 1);
286-
REQUIRE(counts.find(set_x) != counts.end());
287-
REQUIRE(counts.at(set_x).messages == 1);
288-
REQUIRE(counts.at(set_x).bytes == 0);
289256
}
290257
}
291258

src/enclave/enclave.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,6 @@ namespace ccf
247247
bp,
248248
AdminMessage::tick,
249249
[this, &disp = bp.get_dispatcher()](const uint8_t*, size_t) {
250-
const auto message_counts = disp.retrieve_message_counts();
251-
const auto j = disp.convert_message_counts(message_counts);
252-
RINGBUFFER_WRITE_MESSAGE(
253-
AdminMessage::work_stats, to_host, j.dump());
254-
255250
const auto time_now = decltype(last_tick_time)::clock::now();
256251

257252
const auto elapsed_ms =

src/enclave/interface.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,10 @@ enum AdminMessage : ringbuffer::Message
2626
/// Periodically update based on current time. Host -> Enclave
2727
DEFINE_RINGBUFFER_MSG_TYPE(tick),
2828

29-
/// Notify the host of work done since last message. Enclave -> Host
30-
DEFINE_RINGBUFFER_MSG_TYPE(work_stats)
3129
};
3230

3331
DECLARE_RINGBUFFER_MESSAGE_PAYLOAD(AdminMessage::fatal_error_msg, std::string);
3432
DECLARE_RINGBUFFER_MESSAGE_NO_PAYLOAD(AdminMessage::stop);
3533
DECLARE_RINGBUFFER_MESSAGE_NO_PAYLOAD(AdminMessage::stop_notice);
3634
DECLARE_RINGBUFFER_MESSAGE_NO_PAYLOAD(AdminMessage::stopped);
3735
DECLARE_RINGBUFFER_MESSAGE_NO_PAYLOAD(AdminMessage::tick);
38-
DECLARE_RINGBUFFER_MESSAGE_PAYLOAD(AdminMessage::work_stats, std::string);

src/host/load_monitor.h

Lines changed: 0 additions & 100 deletions
This file was deleted.

src/host/run.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include "http/curl.h"
3434
#include "json_schema.h"
3535
#include "lfs_file_handler.h"
36-
#include "load_monitor.h"
3736
#include "node_connections.h"
3837
#include "pal/quote_generation.h"
3938
#include "rpc_connections.h"
@@ -666,9 +665,6 @@ namespace ccf
666665
// reset the inbound-UDP processing quota each iteration
667666
const asynchost::ResetUDPReadQuota reset_udp_quota;
668667

669-
// regularly record some load statistics
670-
const asynchost::LoadMonitor load_monitor(500ms, buffer_processor);
671-
672668
// handle outbound logging and admin messages from the enclave
673669
const asynchost::HandleRingbuffer handle_ringbuffer(
674670
1ms,

0 commit comments

Comments
 (0)