]> git.hungrycats.org Git - bees/commitdiff
reporter: cosmetic improvements: thread name, BEESNOTE, BEESTRACE
authorZygo Blaxell <bees@furryterror.org>
Fri, 19 Jun 2026 16:42:42 +0000 (12:42 -0400)
committerZygo Blaxell <bees@furryterror.org>
Sat, 5 Sep 2026 04:04:12 +0000 (00:04 -0400)
Shorten the extremely limited pthread name.  Add BEESTRACE for
write failure debugging.  Add BEESNOTE so the thread doesn't show
up in the threads report as "thread function".

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
src/bees-reporter.cc

index a321c4fc3d187c1e5f7a8467e3e7e995ddbd9ba3..1f42fcc4690dff8f5f8e750d85b3d0877dd107e6 100644 (file)
@@ -177,7 +177,7 @@ BeesReporter::add_report(const BeesReportConfig &cfg)
 void
 BeesReporter::start()
 {
-       // One thread per active report stanza, named "report_<section>".  Each
+       // One thread per active report stanza, named "rep_<section>".  Each
        // thread owns a single report and just sleeps for its interval between
        // writes, so a report whose target filesystem stalls blocks only its
        // own thread, not the others.  (A stuck target was already reachable
@@ -187,7 +187,7 @@ BeesReporter::start()
                if (!m_reports[i].active || m_reports[i].filename.empty()) {
                        continue;
                }
-               auto thread = make_shared<BeesThread>("report_" + m_reports[i].name);
+               auto thread = make_shared<BeesThread>("rep_" + m_reports[i].name);
                thread->exec([this, i]() {
                        catch_all([this, i]() {
                                run_one(i);
@@ -285,9 +285,11 @@ BeesReporter::run_one(size_t index)
        while (true) {
                catch_all([&]() {
                        BEESNOTE("writing report '" << cfg.name << "'");
+                       BEESTRACE("writing report '" << cfg.name << "'");
                        write_report(cfg);
                });
                unique_lock<mutex> lock(m_mutex);
+               BEESNOTE("waiting " << cfg.interval_s << "s to write report '" << cfg.name << "'");
                if (m_condvar.wait_for(lock, interval, [this]() { return m_stop; })) {
                        break;
                }