refactor: trace actor instance IDs instead of pointer values

This commit is contained in:
CJ van den Berg 2026-03-10 13:35:15 +01:00
parent 5994549daf
commit e430b209eb
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -276,6 +276,7 @@ struct instance : std::enable_shared_from_this<instance> {
} }
auto name() const -> const string & { return name_; } auto name() const -> const string & { return name_; }
auto instance_id() const -> uintptr_t { return instance_id_; }
auto is_enabled(channel c) -> bool { return env_.enabled(c); } auto is_enabled(channel c) -> bool { return env_.enabled(c); }
@ -532,18 +533,16 @@ auto operator==(const handle &a, const handle &b) -> bool {
} }
namespace { namespace {
auto ref_m(const void *p, string name) -> buffer { auto ref_m(uintptr_t id, string name) -> buffer {
stringstream ss; return array("PID", id, move(name));
ss << p;
return array("PID", ss.str(), move(name));
} }
auto ref_m(const instance *p) -> buffer { return ref_m(p, p->name()); } auto ref_m(const instance *p) -> buffer { return ref_m(p->instance_id(), p->name()); }
auto ref_m(const ref &r) -> buffer { auto ref_m(const ref &r) -> buffer {
if (auto p = r.lock()) if (auto p = r.lock())
return ref_m(p.get(), p->name()); return ref_m(p->instance_id(), p->name());
return ref_m(nullptr, "none"); return ref_m(0, "none");
} }
} // namespace } // namespace