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
10 changes: 10 additions & 0 deletions include/tscore/Diags.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ is_dbg_ctl_enabled(DbgCtl const &ctl)
} \
} while (false)

// A BufferWriter version of Dbg().
#define Dbg_bw(ctl__, fmt, ...) \
do { \
if (unlikely(diags()->on())) { \
if (ctl__.ptr()->on) { \
DbgPrint(ctl__, "%s", ts::bwprint(ts::bw_dbg, fmt, __VA_ARGS__).c_str()); \
} \
} \
} while (false)

// A BufferWriter version of Debug().
#define Debug_bw(tag__, fmt, ...) \
do { \
Expand Down
13 changes: 10 additions & 3 deletions iocore/eventsystem/ConfigProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@

ConfigProcessor configProcessor;

namespace
{

DbgCtl dbg_ctl_config{"config"};

}

class ConfigInfoReleaser : public Continuation
{
public:
Expand Down Expand Up @@ -81,8 +88,8 @@ ConfigProcessor::set(unsigned int id, ConfigInfo *info, unsigned timeout_secs)
idx = id - 1;
old_info = infos[idx].exchange(info);

Debug("config", "Set for slot %d 0x%" PRId64 " was 0x%" PRId64 " with ref count %d", id, (int64_t)info, (int64_t)old_info,
(old_info) ? old_info->refcount() : 0);
Dbg(dbg_ctl_config, "Set for slot %d 0x%" PRId64 " was 0x%" PRId64 " with ref count %d", id, (int64_t)info, (int64_t)old_info,
(old_info) ? old_info->refcount() : 0);

if (old_info) {
// The ConfigInfoReleaser now takes our refcount, but
Expand Down Expand Up @@ -132,7 +139,7 @@ ConfigProcessor::release(unsigned int id, ConfigInfo *info)

if (info && info->refcount_dec() == 0) {
// When we release, we should already have replaced this object in the index.
Debug("config", "Release config %d 0x%" PRId64, id, (int64_t)info);
Dbg(dbg_ctl_config, "Release config %d 0x%" PRId64, id, (int64_t)info);
ink_release_assert(info != this->infos[idx]);
delete info;
}
Expand Down
4 changes: 3 additions & 1 deletion iocore/eventsystem/ConfigProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,13 @@ template <typename UpdateClass> struct ConfigUpdateHandler {
{
ConfigUpdateHandler *self = static_cast<ConfigUpdateHandler *>(cookie);

Debug("config", "%s(%s)", __PRETTY_FUNCTION__, name);
Dbg(_dbg_ctl, "%s(%s)", __PRETTY_FUNCTION__, name);
return ConfigScheduleUpdate<UpdateClass>(self->mutex);
}

Ptr<ProxyMutex> mutex;

inline static DbgCtl _dbg_ctl{"config"};
};

extern ConfigProcessor configProcessor;
28 changes: 15 additions & 13 deletions iocore/eventsystem/RecProcess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,36 +43,38 @@ static Event *raw_stat_sync_cont_event;
static Event *config_update_cont_event;
static Event *sync_cont_event;

static DbgCtl dbg_ctl_statsproc{"statsproc"};

//-------------------------------------------------------------------------
// Simple setters for the intervals to decouple this from the proxy
//-------------------------------------------------------------------------
void
RecProcess_set_raw_stat_sync_interval_ms(int ms)
{
Debug("statsproc", "g_rec_raw_stat_sync_interval_ms -> %d", ms);
Dbg(dbg_ctl_statsproc, "g_rec_raw_stat_sync_interval_ms -> %d", ms);
g_rec_raw_stat_sync_interval_ms = ms;
if (raw_stat_sync_cont_event) {
Debug("statsproc", "Rescheduling raw-stat syncer");
Dbg(dbg_ctl_statsproc, "Rescheduling raw-stat syncer");
raw_stat_sync_cont_event->schedule_every(HRTIME_MSECONDS(g_rec_raw_stat_sync_interval_ms));
}
}
void
RecProcess_set_config_update_interval_ms(int ms)
{
Debug("statsproc", "g_rec_config_update_interval_ms -> %d", ms);
Dbg(dbg_ctl_statsproc, "g_rec_config_update_interval_ms -> %d", ms);
g_rec_config_update_interval_ms = ms;
if (config_update_cont_event) {
Debug("statsproc", "Rescheduling config syncer");
Dbg(dbg_ctl_statsproc, "Rescheduling config syncer");
config_update_cont_event->schedule_every(HRTIME_MSECONDS(g_rec_config_update_interval_ms));
}
}
void
RecProcess_set_remote_sync_interval_ms(int ms)
{
Debug("statsproc", "g_rec_remote_sync_interval_ms -> %d", ms);
Dbg(dbg_ctl_statsproc, "g_rec_remote_sync_interval_ms -> %d", ms);
g_rec_remote_sync_interval_ms = ms;
if (sync_cont_event) {
Debug("statsproc", "Rescheduling remote syncer");
Dbg(dbg_ctl_statsproc, "Rescheduling remote syncer");
sync_cont_event->schedule_every(HRTIME_MSECONDS(g_rec_remote_sync_interval_ms));
}
}
Expand All @@ -86,7 +88,7 @@ struct raw_stat_sync_cont : public Continuation {
exec_callbacks(int /* event */, Event * /* e */)
{
RecExecRawStatSyncCbs();
Debug("statsproc", "raw_stat_sync_cont() processed");
Dbg(dbg_ctl_statsproc, "raw_stat_sync_cont() processed");

return EVENT_CONT;
}
Expand All @@ -101,7 +103,7 @@ struct config_update_cont : public Continuation {
exec_callbacks(int /* event */, Event * /* e */)
{
RecExecConfigUpdateCbs(REC_PROCESS_UPDATE_REQUIRED);
Debug("statsproc", "config_update_cont() processed");
Dbg(dbg_ctl_statsproc, "config_update_cont() processed");

return EVENT_CONT;
}
Expand Down Expand Up @@ -132,7 +134,7 @@ struct sync_cont : public Continuation {
{
RecSyncStatsFile();

Debug("statsproc", "sync_cont() processed");
Dbg(dbg_ctl_statsproc, "sync_cont() processed");

return EVENT_CONT;
}
Expand Down Expand Up @@ -173,17 +175,17 @@ RecProcessStart()
return REC_ERR_OKAY;
}

Debug("statsproc", "Starting sync continuations:");
Dbg(dbg_ctl_statsproc, "Starting sync continuations:");
raw_stat_sync_cont *rssc = new raw_stat_sync_cont(new_ProxyMutex());
Debug("statsproc", "raw-stat syncer");
Dbg(dbg_ctl_statsproc, "raw-stat syncer");
raw_stat_sync_cont_event = eventProcessor.schedule_every(rssc, HRTIME_MSECONDS(g_rec_raw_stat_sync_interval_ms), ET_TASK);

config_update_cont *cuc = new config_update_cont(new_ProxyMutex());
Debug("statsproc", "config syncer");
Dbg(dbg_ctl_statsproc, "config syncer");
config_update_cont_event = eventProcessor.schedule_every(cuc, HRTIME_MSECONDS(g_rec_config_update_interval_ms), ET_TASK);

sync_cont *sc = new sync_cont(new_ProxyMutex());
Debug("statsproc", "remote syncer");
Dbg(dbg_ctl_statsproc, "remote syncer");
sync_cont_event = eventProcessor.schedule_every(sc, HRTIME_MSECONDS(g_rec_remote_sync_interval_ms), ET_TASK);

g_started = true;
Expand Down
9 changes: 6 additions & 3 deletions iocore/eventsystem/RecRawStatsImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ struct RecRawStatBlockOpsImpl : RecRawStatBlockOps {
int raw_stat_clear_sum(RecRawStatBlock *rsb, int id) override;
int raw_stat_get_total(RecRawStatBlock *rsb, int id, RecRawStat *total) override;
int raw_stat_sync_to_global(RecRawStatBlock *rsb, int id) override;

private:
inline static DbgCtl _dbg_ctl{"stats"};
};

RecRawStatBlock *
Expand Down Expand Up @@ -166,7 +169,7 @@ RecRawStatBlockOpsImpl::raw_stat_sync_to_global(RecRawStatBlock *rsb, int id)
int
RecRawStatBlockOpsImpl::raw_stat_clear(RecRawStatBlock *rsb, int id)
{
Debug("stats", "raw_stat_clear(): rsb pointer:%p id:%d", rsb, id);
Dbg(_dbg_ctl, "raw_stat_clear(): rsb pointer:%p id:%d", rsb, id);

// the globals need to be reset too
// lock so the setting of the globals and last values are atomic
Expand Down Expand Up @@ -199,7 +202,7 @@ RecRawStatBlockOpsImpl::raw_stat_clear(RecRawStatBlock *rsb, int id)
int
RecRawStatBlockOpsImpl::raw_stat_clear_sum(RecRawStatBlock *rsb, int id)
{
Debug("stats", "raw_stat_clear_sum(): rsb pointer:%p id:%d", rsb, id);
Dbg(_dbg_ctl, "raw_stat_clear_sum(): rsb pointer:%p id:%d", rsb, id);

// the globals need to be reset too
// lock so the setting of the globals and last values are atomic
Expand Down Expand Up @@ -229,7 +232,7 @@ RecRawStatBlockOpsImpl::raw_stat_clear_sum(RecRawStatBlock *rsb, int id)
int
RecRawStatBlockOpsImpl::raw_stat_clear_count(RecRawStatBlock *rsb, int id)
{
Debug("stats", "raw_stat_clear_count(): rsb pointer:%p id:%d", rsb, id);
Dbg(_dbg_ctl, "raw_stat_clear_count(): rsb pointer:%p id:%d", rsb, id);

// the globals need to be reset too
// lock so the setting of the globals and last values are atomic
Expand Down
Loading