From 8ff07e69a3a0e88e7d4a6f57c042b91ebac30504 Mon Sep 17 00:00:00 2001 From: kanoi Date: Fri, 10 Apr 2015 12:28:52 +1000 Subject: [PATCH] ckpool - add start time and pid to seq information --- src/ckpool.c | 2 ++ src/ckpool.h | 4 ++++ src/stratifier.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/ckpool.c b/src/ckpool.c index 1ffe45f4..d3516b1a 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -1397,6 +1397,8 @@ int main(int argc, char **argv) global_ckp = &ckp; memset(&ckp, 0, sizeof(ckp)); + ckp.starttime = time(NULL); + ckp.startpid = getpid(); ckp.loglevel = LOG_NOTICE; ckp.initial_args = ckalloc(sizeof(char *) * (argc + 2)); /* Leave room for extra -H */ for (ckp.args = 0; ckp.args < argc; ckp.args++) diff --git a/src/ckpool.h b/src/ckpool.h index 86b8ff3f..fd192f97 100644 --- a/src/ckpool.h +++ b/src/ckpool.h @@ -99,6 +99,10 @@ struct server_instance { typedef struct server_instance server_instance_t; struct ckpool_instance { + /* Start time */ + time_t starttime; + /* Start pid */ + pid_t startpid; /* The initial command line arguments */ char **initial_args; /* Number of arguments */ diff --git a/src/stratifier.c b/src/stratifier.c index 63c46175..9d51a4f8 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -640,6 +640,8 @@ static char *ckdb_msg(ckpool_t *ckp, sdata_t *sdata, json_t *val, const int idty /* Set the atomically incrementing sequence number */ mutex_lock(&sdata->ckdb_msg_lock); + json_set_int(val, "seqstart", ckp->starttime); + json_set_int(val, "seqpid", ckp->startpid); json_set_int(val, "seqall", sdata->ckdb_seq++); json_set_int(val, ckdb_seq_names[idtype], sdata->ckdb_seq_ids[idtype]++); mutex_unlock(&sdata->ckdb_msg_lock);