|
|
@ -2036,14 +2036,16 @@ static void trans_process(SEQSET *seqset, tv_t *now, K_STORE *store) |
|
|
|
static void trans_seq(tv_t *now) |
|
|
|
static void trans_seq(tv_t *now) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char t_buf[DATE_BUFSIZ], t_buf2[DATE_BUFSIZ]; |
|
|
|
char t_buf[DATE_BUFSIZ], t_buf2[DATE_BUFSIZ]; |
|
|
|
|
|
|
|
char range[64]; |
|
|
|
K_STORE *store; |
|
|
|
K_STORE *store; |
|
|
|
SEQSET *seqset = NULL; |
|
|
|
SEQSET *seqset = NULL; |
|
|
|
K_ITEM *item = NULL, *lastitem = NULL; |
|
|
|
K_ITEM *item = NULL, *lastitem = NULL; |
|
|
|
SEQTRANS *seqtrans; |
|
|
|
SEQTRANS *seqtrans; |
|
|
|
K_ITEM *st_item; |
|
|
|
K_ITEM *st_item; |
|
|
|
uint64_t seqstt = 0, seqpid = 0; |
|
|
|
uint64_t seqstt = 0, seqpid = 0, seqnum0, seqnum1; |
|
|
|
bool more = true; |
|
|
|
tv_t seqsec; |
|
|
|
int i, j; |
|
|
|
bool more = true, gotseq; |
|
|
|
|
|
|
|
int i, j, nam; |
|
|
|
|
|
|
|
|
|
|
|
store = k_new_store(seqtrans_free); |
|
|
|
store = k_new_store(seqtrans_free); |
|
|
|
for (i = 0; more; i++) { |
|
|
|
for (i = 0; more; i++) { |
|
|
@ -2077,18 +2079,72 @@ static void trans_seq(tv_t *now) |
|
|
|
SEQUNLOCK(); |
|
|
|
SEQUNLOCK(); |
|
|
|
|
|
|
|
|
|
|
|
st_item = STORE_TAIL_NOLOCK(store); |
|
|
|
st_item = STORE_TAIL_NOLOCK(store); |
|
|
|
|
|
|
|
/* Display one line for all records that would display the same
|
|
|
|
|
|
|
|
* excluding the sequence number - displayed as a continuous |
|
|
|
|
|
|
|
* range */ |
|
|
|
|
|
|
|
seqnum0 = seqnum1 = 0; |
|
|
|
|
|
|
|
seqsec.tv_sec = 0; |
|
|
|
|
|
|
|
gotseq = false; |
|
|
|
|
|
|
|
nam = -1; |
|
|
|
while (st_item) { |
|
|
|
while (st_item) { |
|
|
|
DATA_SEQTRANS(seqtrans, st_item); |
|
|
|
DATA_SEQTRANS(seqtrans, st_item); |
|
|
|
btu64_to_buf(&seqstt, t_buf, sizeof(t_buf)); |
|
|
|
if (!gotseq) { |
|
|
|
bt_to_buf(&(seqtrans->entry.time.tv_sec), t_buf2, |
|
|
|
seqnum0 = seqnum1 = seqtrans->seqnum; |
|
|
|
sizeof(t_buf2)); |
|
|
|
nam = seqtrans->seq; |
|
|
|
LOGWARNING("Seq trans %s %"PRIu64" set:%d/%"PRIu64 |
|
|
|
seqsec.tv_sec = seqtrans->entry.time.tv_sec; |
|
|
|
"=%s/%"PRIu64" %s/%s", |
|
|
|
gotseq = true; |
|
|
|
seqnam[seqtrans->seq], seqtrans->seqnum, |
|
|
|
} else { |
|
|
|
i, seqstt, t_buf, seqpid, |
|
|
|
if (seqtrans->seqnum == seqnum1+1 && |
|
|
|
t_buf2, seqtrans->entry.code); |
|
|
|
seqtrans->seq == nam && |
|
|
|
|
|
|
|
seqtrans->entry.time.tv_sec == seqsec.tv_sec) { |
|
|
|
|
|
|
|
seqnum1++; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// Display the previous range
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (seqnum0 == seqnum1) { |
|
|
|
|
|
|
|
snprintf(range, sizeof(range), |
|
|
|
|
|
|
|
"%"PRIu64, seqnum1); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
snprintf(range, sizeof(range), |
|
|
|
|
|
|
|
"%"PRIu64"-%"PRIu64, |
|
|
|
|
|
|
|
seqnum0, seqnum1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
btu64_to_buf(&seqstt, t_buf, |
|
|
|
|
|
|
|
sizeof(t_buf)); |
|
|
|
|
|
|
|
bt_to_buf(&(seqsec.tv_sec), t_buf2, |
|
|
|
|
|
|
|
sizeof(t_buf2)); |
|
|
|
|
|
|
|
LOGWARNING("Seq trans %s %s set:%d/" |
|
|
|
|
|
|
|
"%"PRIu64"=%s/%"PRIu64" %s", |
|
|
|
|
|
|
|
seqnam[nam], range, |
|
|
|
|
|
|
|
i, seqstt, t_buf, seqpid, |
|
|
|
|
|
|
|
t_buf2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Current record is a new range
|
|
|
|
|
|
|
|
seqnum0 = seqnum1 = seqtrans->seqnum; |
|
|
|
|
|
|
|
nam = seqtrans->seq; |
|
|
|
|
|
|
|
seqsec.tv_sec = seqtrans->entry.time.tv_sec; |
|
|
|
|
|
|
|
gotseq = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
st_item = st_item->prev; |
|
|
|
st_item = st_item->prev; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Display the last range if there was one
|
|
|
|
|
|
|
|
if (gotseq) { |
|
|
|
|
|
|
|
if (seqnum0 == seqnum1) { |
|
|
|
|
|
|
|
snprintf(range, sizeof(range), |
|
|
|
|
|
|
|
"%"PRIu64, seqnum1); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
snprintf(range, sizeof(range), |
|
|
|
|
|
|
|
"%"PRIu64"-%"PRIu64, |
|
|
|
|
|
|
|
seqnum0, seqnum1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
btu64_to_buf(&seqstt, t_buf, sizeof(t_buf)); |
|
|
|
|
|
|
|
bt_to_buf(&(seqsec.tv_sec), t_buf2, sizeof(t_buf2)); |
|
|
|
|
|
|
|
LOGWARNING("Seq trans %s %s set:%d/" |
|
|
|
|
|
|
|
"%"PRIu64"=%s/%"PRIu64" %s", |
|
|
|
|
|
|
|
seqnam[nam], range, i, seqstt, t_buf, |
|
|
|
|
|
|
|
seqpid, t_buf2); |
|
|
|
|
|
|
|
} |
|
|
|
if (store->count) { |
|
|
|
if (store->count) { |
|
|
|
K_WLOCK(seqtrans_free); |
|
|
|
K_WLOCK(seqtrans_free); |
|
|
|
k_list_transfer_to_head(store, seqtrans_free); |
|
|
|
k_list_transfer_to_head(store, seqtrans_free); |
|
|
|