Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Framework/Core/src/ControlWebSocketHandler.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
#include "StatusWebSocketHandler.h"
#include "Framework/DeviceMetricsHelper.h"
#include "Framework/ServiceMetricsInfo.h"
#include "Framework/Signpost.h"
#include <regex>
#include "Framework/Logger.h"
#include "Framework/DeviceConfigInfo.h"

O2_DECLARE_DYNAMIC_LOG(rate_limiting);

namespace o2::framework
{
void ControlWebSocketHandler::frame(char const* frame, size_t s)
Expand Down Expand Up @@ -74,6 +77,10 @@ void ControlWebSocketHandler::endChunk()
if (!didProcessMetric) {
return;
}
O2_SIGNPOST_ID_GENERATE(sid, rate_limiting);
O2_SIGNPOST_START(rate_limiting, sid, "endChunk",
"Processing metrics from device %d (had new metric: %d)",
mIndex, (int)didHaveNewMetric);
size_t timestamp = (uv_hrtime() - mContext.driver->startTime) / 1000000 + mContext.driver->startTimeMsFromEpoch;
assert(mContext.metrics);
assert(mContext.infos);
Expand All @@ -91,6 +98,8 @@ void ControlWebSocketHandler::endChunk()
for (auto& metricsInfo : *mContext.metrics) {
std::fill(metricsInfo.changed.begin(), metricsInfo.changed.end(), false);
}
O2_SIGNPOST_END(rate_limiting, sid, "endChunk",
"Done processing metrics from device %d", mIndex);
}

void ControlWebSocketHandler::headers(std::map<std::string, std::string> const& headers)
Expand Down
11 changes: 11 additions & 0 deletions Framework/Core/src/DevicesManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@
#include "Framework/RuntimeError.h"
#include "Framework/Logger.h"
#include "Framework/DeviceController.h"
#include "Framework/Signpost.h"

O2_DECLARE_DYNAMIC_LOG(devices_manager);

namespace o2::framework
{

void DevicesManager::queueMessage(char const* target, char const* message)
{
O2_SIGNPOST_ID_GENERATE(sid, devices_manager);
O2_SIGNPOST_EVENT_EMIT(devices_manager, sid, "queue",
"Queuing message for %{public}s: %{public}s",
target, message);
for (int di = 0; di < specs.size(); ++di) {
if (specs[di].id == target) {
messages.push_back({di, message});
Expand All @@ -44,6 +51,10 @@ void DevicesManager::flush()
LOGP(info, "Controller for {} now available.", specs[handle.ref.index].id);
notifiedAvailable = true;
}
O2_SIGNPOST_ID_GENERATE(sid, devices_manager);
O2_SIGNPOST_EVENT_EMIT(devices_manager, sid, "flush",
"Flushing message to %{public}s: %{public}s",
specs[handle.ref.index].id.c_str(), handle.message.c_str());
controller->write(handle.message.c_str(), handle.message.size());
}

Expand Down