Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add 'reserves' counter per job

Closes gh-10.
  • Loading branch information...
commit fdd7693d73e25685f09274a0d051d38a200837ad 1 parent 5192ce5
goosmurf authored committed
Showing with 7 additions and 1 deletion.
  1. +2 −0  doc/protocol.txt
  2. +1 −1  job.c
  3. +1 −0  job.h
  4. +3 −0  prot.c
View
2  doc/protocol.txt
@@ -430,6 +430,8 @@ to scalars. It contains these keys:
reserved or delayed. If the job is reserved and this amount of time
elapses before its state changes, it is considered to have timed out.
+ - "reserves" is the number of times this job has been reserved.
+
- "timeouts" is the number of times this job has timed out during a
reservation.
View
2  job.c
@@ -111,7 +111,7 @@ allocate_job(int body_size)
j->id = 0;
j->state = JOB_STATE_INVALID;
j->creation = time(NULL);
- j->timeout_ct = j->release_ct = j->bury_ct = j->kick_ct = 0;
+ j->reserve_ct = j->timeout_ct = j->release_ct = j->bury_ct = j->kick_ct = 0;
j->body_size = body_size;
j->next = j->prev = j; /* not in a linked list */
j->ht_next = NULL;
View
1  job.h
@@ -44,6 +44,7 @@ struct job {
int body_size;
time_t creation;
time_t deadline;
+ unsigned int reserve_ct;
unsigned int timeout_ct;
unsigned int release_ct;
unsigned int bury_ct;
View
3  prot.c
@@ -218,6 +218,7 @@ size_t job_data_size_limit = JOB_DATA_SIZE_LIMIT_DEFAULT;
"delay: %u\n" \
"ttr: %u\n" \
"time-left: %u\n" \
+ "reserves: %u\n" \
"timeouts: %u\n" \
"releases: %u\n" \
"buries: %u\n" \
@@ -350,6 +351,7 @@ reserve_job(conn c, job j)
j->deadline = time(NULL) + j->ttr;
global_stat.reserved_ct++; /* stats */
j->tube->stat.reserved_ct++;
+ j->reserve_ct++;
conn_insert(&running, c);
j->state = JOB_STATE_RESERVED;
job_insert(&c->reserved_jobs, j);
@@ -980,6 +982,7 @@ fmt_job_stats(char *buf, size_t size, job j)
j->delay,
j->ttr,
(unsigned int) (j->deadline - t),
+ j->reserve_ct,
j->timeout_ct,
j->release_ct,
j->bury_ct,
Please sign in to comment.
Something went wrong with that request. Please try again.