Browse Source

ckpool - add start time and pid to seq information

master
kanoi 10 years ago
parent
commit
8ff07e69a3
  1. 2
      src/ckpool.c
  2. 4
      src/ckpool.h
  3. 2
      src/stratifier.c

2
src/ckpool.c

@ -1397,6 +1397,8 @@ int main(int argc, char **argv)
global_ckp = &ckp; global_ckp = &ckp;
memset(&ckp, 0, sizeof(ckp)); memset(&ckp, 0, sizeof(ckp));
ckp.starttime = time(NULL);
ckp.startpid = getpid();
ckp.loglevel = LOG_NOTICE; ckp.loglevel = LOG_NOTICE;
ckp.initial_args = ckalloc(sizeof(char *) * (argc + 2)); /* Leave room for extra -H */ ckp.initial_args = ckalloc(sizeof(char *) * (argc + 2)); /* Leave room for extra -H */
for (ckp.args = 0; ckp.args < argc; ckp.args++) for (ckp.args = 0; ckp.args < argc; ckp.args++)

4
src/ckpool.h

@ -99,6 +99,10 @@ struct server_instance {
typedef struct server_instance server_instance_t; typedef struct server_instance server_instance_t;
struct ckpool_instance { struct ckpool_instance {
/* Start time */
time_t starttime;
/* Start pid */
pid_t startpid;
/* The initial command line arguments */ /* The initial command line arguments */
char **initial_args; char **initial_args;
/* Number of arguments */ /* Number of arguments */

2
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 */ /* Set the atomically incrementing sequence number */
mutex_lock(&sdata->ckdb_msg_lock); 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, "seqall", sdata->ckdb_seq++);
json_set_int(val, ckdb_seq_names[idtype], sdata->ckdb_seq_ids[idtype]++); json_set_int(val, ckdb_seq_names[idtype], sdata->ckdb_seq_ids[idtype]++);
mutex_unlock(&sdata->ckdb_msg_lock); mutex_unlock(&sdata->ckdb_msg_lock);

Loading…
Cancel
Save