11#pragma once
22
3+ #include < memory>
34#include < string_view>
45
56namespace plugify {
@@ -50,7 +51,7 @@ namespace plugify {
5051 // virtual void TrackFree(void* ptr, std::string_view pool = {}) = 0;
5152
5253 // Thread metadata
53- virtual void SetThreadName (std::string_view name) = 0;
54+ virtual void SetThread (std::string_view name) = 0;
5455
5556 // Capability query
5657 virtual std::string_view GetName () const = 0; // "Tracy", "Optick", …
@@ -59,17 +60,38 @@ namespace plugify {
5960
6061 class ScopedZone {
6162 public:
62- ScopedZone (IProfiler* profiler, const ZoneDesc& desc) : _profiler(profiler) {
63+ ScopedZone () = default ;
64+
65+ ScopedZone (const std::shared_ptr<IProfiler>& profiler, const ZoneDesc& desc) : _profiler(profiler.get()) {
6366 if (_profiler) _handle = _profiler->BeginZone (desc);
6467 }
68+
6569 ~ScopedZone () {
6670 if (_profiler && _handle) _profiler->EndZone (_handle);
6771 }
6872
6973 ScopedZone (const ScopedZone&) = delete ;
7074 ScopedZone& operator =(const ScopedZone&) = delete ;
71- ScopedZone (ScopedZone&&) = delete ;
72- ScopedZone& operator =(ScopedZone&&) = delete ;
75+
76+ ScopedZone (ScopedZone&& other) noexcept
77+ : _profiler(other._profiler)
78+ , _handle(other._handle) {
79+ other._profiler = nullptr ;
80+ other._handle = {};
81+ }
82+
83+ ScopedZone& operator =(ScopedZone&& other) noexcept {
84+ if (this != &other) {
85+ if (_profiler && _handle) _profiler->EndZone (_handle);
86+
87+ _profiler = other._profiler ;
88+ _handle = other._handle ;
89+
90+ other._profiler = nullptr ;
91+ other._handle = {};
92+ }
93+ return *this ;
94+ }
7395
7496 private:
7597 IProfiler* _profiler = nullptr ;
0 commit comments