Browse Source

ckdb - add a file processing time ratio to the reload messages

master
kanoi 8 years ago
parent
commit
1c42be20ff
  1. 13
      src/ckdb.c
  2. 6
      src/ckdb.h

13
src/ckdb.c

@ -6730,7 +6730,7 @@ static bool reload_from(tv_t *start, const tv_t *finish)
char *filename = NULL; char *filename = NULL;
uint64_t count, total; uint64_t count, total;
tv_t now, begin, file_begin, file_end; tv_t now, begin, file_begin, file_end;
double diff; double diff, ratio;
FILE *fp = NULL; FILE *fp = NULL;
int file_N_limit; int file_N_limit;
time_t tick_time, tmp_time; time_t tick_time, tmp_time;
@ -6815,12 +6815,14 @@ static bool reload_from(tv_t *start, const tv_t *finish)
diff = tvdiff(&file_end, &file_begin); diff = tvdiff(&file_end, &file_begin);
if (diff == 0) if (diff == 0)
diff = 1; diff = 1;
ratio = (double)ROLL_S / diff;
LOGWARNING("%s(): %sread %"PRIu64" line%s %.2f/s from %s", LOGWARNING("%s(): %sread %"PRIu64" line%s %.2f/s (%.1fx)"
" from %s",
__func__, __func__,
everyone_die ? "Terminate, aborting - " : "", everyone_die ? "Terminate, aborting - " : "",
count, count == 1 ? "" : "s", (count / diff), count, count == 1 ? "" : "s", (count / diff),
filename); ratio, filename);
total += count; total += count;
if (apipe) { if (apipe) {
pclose(fp); pclose(fp);
@ -6905,14 +6907,15 @@ static bool reload_from(tv_t *start, const tv_t *finish)
diff = tvdiff(&now, &begin); diff = tvdiff(&now, &begin);
if (diff == 0) if (diff == 0)
diff = 1; diff = 1;
ratio = (double)(processing * ROLL_S) / diff;
snprintf(reload_buf, MAX_READ, "reload.%s.%"PRIu64, run, total); snprintf(reload_buf, MAX_READ, "reload.%s.%"PRIu64, run, total);
LOGQUE(reload_buf, true); LOGQUE(reload_buf, true);
LOGQUE(reload_buf, false); LOGQUE(reload_buf, false);
LOGWARNING("%s(): read %d file%s, total %"PRIu64" line%s %.2f/s", LOGWARNING("%s(): read %d file%s, total %"PRIu64" line%s %.2f/s (%.1fx)",
__func__, __func__,
processing, processing == 1 ? "" : "s", processing, processing == 1 ? "" : "s",
total, total == 1 ? "" : "s", (total / diff)); total, total == 1 ? "" : "s", (total / diff), ratio);
if (everyone_die) if (everyone_die)
return true; return true;

6
src/ckdb.h

@ -58,7 +58,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "1.0.7" #define DB_VERSION "1.0.7"
#define CKDB_VERSION DB_VERSION"-2.411" #define CKDB_VERSION DB_VERSION"-2.412"
#define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__ #define WHERE_FFL_HERE __FILE__, __func__, __LINE__
@ -3063,9 +3063,9 @@ extern char *_t_to_buf(time_t *data, char *buf, size_t siz, WHERE_FFL_ARGS);
// Convert seconds (only) time to (brief) M-DD/HH:MM:SS // Convert seconds (only) time to (brief) M-DD/HH:MM:SS
extern char *_bt_to_buf(time_t *data, char *buf, size_t siz, WHERE_FFL_ARGS); extern char *_bt_to_buf(time_t *data, char *buf, size_t siz, WHERE_FFL_ARGS);
extern char *_btu64_to_buf(uint64_t *data, char *buf, size_t siz, WHERE_FFL_ARGS); extern char *_btu64_to_buf(uint64_t *data, char *buf, size_t siz, WHERE_FFL_ARGS);
// Convert tv to HH:MM:SS // Convert to HH:MM:SS
extern char *_hms_to_buf(time_t *data, char *buf, size_t siz, WHERE_FFL_ARGS); extern char *_hms_to_buf(time_t *data, char *buf, size_t siz, WHERE_FFL_ARGS);
// Convert tv to MM:SS // Convert to MM:SS
extern char *_ms_to_buf(time_t *data, char *buf, size_t siz, WHERE_FFL_ARGS); extern char *_ms_to_buf(time_t *data, char *buf, size_t siz, WHERE_FFL_ARGS);
extern char *_transfer_data(K_ITEM *item, WHERE_FFL_ARGS); extern char *_transfer_data(K_ITEM *item, WHERE_FFL_ARGS);

Loading…
Cancel
Save