Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tube enqueue dequeue counts #90

Closed
Closed
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
3 changes: 3 additions & 0 deletions dat.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ struct stats {
uint pause_ct;
uint64 total_delete_ct;
uint64 total_jobs_ct;

uint64 total_put_ct;
uint64 total_reserve_ct;
};


Expand Down
6 changes: 6 additions & 0 deletions prot.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ size_t job_data_size_limit = JOB_DATA_SIZE_LIMIT_DEFAULT;
"cmd-delete: %" PRIu64 "\n" \
"cmd-pause-tube: %u\n" \
"pause: %" PRIu64 "\n" \
"put-total: %" PRIu64 "\n" \
"reserve-total: %" PRIu64 "\n" \
"pause-time-left: %" PRId64 "\n" \
"\r\n"

Expand Down Expand Up @@ -426,6 +428,7 @@ enqueue_job(Srv *s, job j, int64 delay, char update_store)
if (!r) return 0;
j->r.state = Ready;
ready_ct++;
j->tube->stat.total_put_ct++;
if (j->r.pri < URGENT_THRESHOLD) {
global_stat.urgent_ct++;
j->tube->stat.urgent_ct++;
Expand Down Expand Up @@ -618,6 +621,7 @@ remove_ready_job(job j)
if (!j || j->r.state != Ready) return NULL;
heapremove(&j->tube->ready, j->heap_index);
ready_ct--;
j->tube->stat.total_reserve_ct++;
if (j->r.pri < URGENT_THRESHOLD) {
global_stat.urgent_ct--;
j->tube->stat.urgent_ct--;
Expand Down Expand Up @@ -1089,6 +1093,8 @@ fmt_stats_tube(char *buf, size_t size, tube t)
t->stat.waiting_ct,
t->stat.total_delete_ct,
t->stat.pause_ct,
t->stat.total_put_ct,
t->stat.total_reserve_ct,
t->pause / 1000000000,
time_left);
}
Expand Down