Skip to content

Commit 9ac8dec

Browse files
committed
Rename sampling monitor back to resource monitor
1 parent e3c1db6 commit 9ac8dec

6 files changed

Lines changed: 21 additions & 22 deletions

File tree

cpp/include/raft/core/detail/nvtx_range_stack.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ struct nvtx_range_name_stack {
9999
* Innermost NVTX range name and stack depth.
100100
* Mutex-free — ONLY safe to call from the thread that owns this stack.
101101
*/
102-
[[nodiscard]] auto current_name_and_depth() const noexcept
103-
-> std::pair<std::string, std::size_t>
102+
[[nodiscard]] auto current_name_and_depth() const noexcept -> std::pair<std::string, std::size_t>
104103
{
105104
if (stack_.empty()) { return {"", 0}; }
106105
return {stack_.back().second, stack_.size()};

cpp/include/raft/core/memory_logging_resources.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ class memory_logging_resources : public resources {
9191

9292
private:
9393
memory_logging_resources(const resources* existing,
94-
std::unique_ptr<std::ofstream> owned_stream,
95-
std::ostream* out_override)
94+
std::unique_ptr<std::ofstream> owned_stream,
95+
std::ostream* out_override)
9696
: resources(existing ? *existing : resources{}),
9797
owned_stream_(std::move(owned_stream)),
9898
old_host_(raft::mr::get_default_host_resource()),
@@ -186,8 +186,7 @@ class memory_logging_resources : public resources {
186186
{
187187
int id = recorder_->register_source("large_workspace");
188188
raft::resource::set_large_workspace_resource(
189-
*this,
190-
raft::mr::recording_adaptor<rmm::device_async_resource_ref>{lws_ref, queue, id});
189+
*this, raft::mr::recording_adaptor<rmm::device_async_resource_ref>{lws_ref, queue, id});
191190
}
192191

193192
recorder_->start();

cpp/include/raft/mr/notifying_adaptor.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
#pragma once
@@ -67,7 +67,7 @@ class notifier {
6767
* or deallocation.
6868
*
6969
* Forwards all calls to the upstream resource, then calls notifier::notify().
70-
* A separate consumer (e.g. sampling_monitor) can call notifier::wait() to
70+
* A separate consumer (e.g. resource_monitor) can call notifier::wait() to
7171
* block until activity occurs.
7272
*
7373
* @tparam Upstream Stored by value. Use a concrete resource type for owning

cpp/include/raft/mr/recording_adaptor.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
#include <raft/core/detail/macros.hpp>
88
#include <raft/core/detail/nvtx_range_stack.hpp> // thread_local_current_path, thread_local_current_name_and_depth
9-
#include <raft/mr/recording_monitor.hpp> // allocation_event, allocation_event_queue
10-
#include <raft/mr/statistics_adaptor.hpp> // resource_stats (atomic counters, reused)
9+
#include <raft/mr/recording_monitor.hpp> // allocation_event, allocation_event_queue
10+
#include <raft/mr/statistics_adaptor.hpp> // resource_stats (atomic counters, reused)
1111

1212
#include <cuda/memory_resource>
1313
#include <cuda/stream_ref>
@@ -47,7 +47,8 @@ class recording_adaptor : public cuda::forward_property<recording_adaptor<Upstre
4747

4848
// Record the alloc-time NVTX path for this pointer.
4949
// Called on the allocating thread — mutex-free NVTX read is safe.
50-
// The alloc_map_ mutex still protects the shared map from concurrent alloc/dealloc across threads.
50+
// The alloc_map_ mutex still protects the shared map from concurrent alloc/dealloc across
51+
// threads.
5152
auto record_allocation(void* ptr) noexcept -> std::string
5253
{
5354
std::string path = "";
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
#pragma once
@@ -39,7 +39,7 @@ namespace mr {
3939
*
4040
* start() and stop() are idempotent.
4141
*/
42-
class sampling_monitor {
42+
class resource_monitor {
4343
std::ostream& out_;
4444
std::chrono::steady_clock::duration sample_interval_;
4545
std::shared_ptr<notifier> notifier_;
@@ -55,18 +55,18 @@ class sampling_monitor {
5555
* @param out Output stream for CSV rows.
5656
* @param sample_interval Minimum time between successive samples.
5757
*/
58-
explicit sampling_monitor(std::ostream& out, std::chrono::steady_clock::duration sample_interval)
58+
explicit resource_monitor(std::ostream& out, std::chrono::steady_clock::duration sample_interval)
5959
: out_(out),
6060
sample_interval_(sample_interval),
6161
notifier_(std::make_shared<notifier>()),
6262
nvtx_range_(raft::common::nvtx::thread_local_current_range())
6363
{
6464
}
6565

66-
~sampling_monitor() { stop(); }
66+
~resource_monitor() { stop(); }
6767

68-
sampling_monitor(sampling_monitor const&) = delete;
69-
sampling_monitor& operator=(sampling_monitor const&) = delete;
68+
resource_monitor(resource_monitor const&) = delete;
69+
resource_monitor& operator=(resource_monitor const&) = delete;
7070

7171
/**
7272
* @brief Shared notifier for notifying_adaptor instances.

cpp/tests/core/allocation_tracking.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

66
#include <raft/mr/host_memory_resource.hpp>
77
#include <raft/mr/notifying_adaptor.hpp>
8-
#include <raft/mr/sampling_monitor.hpp>
8+
#include <raft/mr/resource_monitor.hpp>
99
#include <raft/mr/statistics_adaptor.hpp>
1010

1111
#include <gtest/gtest.h>
@@ -69,7 +69,7 @@ TEST(AllocationReport, WritesCSVOnDirty)
6969
using namespace std::chrono_literals;
7070

7171
std::ostringstream oss;
72-
raft::mr::sampling_monitor report(oss, 1ms);
72+
raft::mr::resource_monitor report(oss, 1ms);
7373

7474
auto host_stats = std::make_shared<raft::mr::resource_stats>();
7575
auto pinned_stats = std::make_shared<raft::mr::resource_stats>();
@@ -98,7 +98,7 @@ TEST(AllocationReport, StartStopIdempotent)
9898
using namespace std::chrono_literals;
9999

100100
std::ostringstream oss;
101-
raft::mr::sampling_monitor report(oss, 1ms);
101+
raft::mr::resource_monitor report(oss, 1ms);
102102

103103
auto stats = std::make_shared<raft::mr::resource_stats>();
104104
report.register_source("test", stats);
@@ -124,7 +124,7 @@ TEST(AllocationReport, DestructorCallsStop)
124124
std::ostringstream oss;
125125
{
126126
auto stats = std::make_shared<raft::mr::resource_stats>();
127-
raft::mr::sampling_monitor report(oss, 1ms);
127+
raft::mr::resource_monitor report(oss, 1ms);
128128
report.register_source("test", stats);
129129

130130
stats->record_allocate(256);

0 commit comments

Comments
 (0)