1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

replace macro CHECKPOINT_VERBOSE by the variable verbose

This commit is contained in:
Stefan Lankes 2017-04-24 13:24:21 +02:00
parent 72c45ea859
commit 1db47acc62

View file

@ -139,8 +139,6 @@
#define PAGE_MAP_BITS 9
#define PAGE_LEVELS 4
#define CHECKPOINT_VERBOSE 1
#define kvm_ioctl(fd, cmd, arg) ({ \
const int ret = ioctl(fd, cmd, arg); \
if(ret == -1) \
@ -1027,9 +1025,8 @@ int uhyve_init(char *path)
fscanf(f, "memory size: 0x%zx\n", &guest_size);
fscanf(f, "checkpoint number: %u\n", &no_checkpoint);
fscanf(f, "entry point: 0x%zx", &elf_entry);
#if CHECKPOINT_VERBOSE
printf("Restart from checkpoint %u (ncores %d, mem size 0x%zx)\n", no_checkpoint, ncores, guest_size);
#endif
if (verbose)
fprintf(stderr, "Restart from checkpoint %u (ncores %d, mem size 0x%zx)\n", no_checkpoint, ncores, guest_size);
fclose(f);
} else {
const char* hermit_memory = getenv("HERMIT_MEM");
@ -1147,11 +1144,10 @@ static void timer_handler(int signum)
struct stat st = {0};
const size_t flag = no_checkpoint > 0 ? PG_DIRTY : PG_ACCESSED;
char fname[MAX_FNAME];
#if CHECKPOINT_VERBOSE
struct timeval begin, end;
gettimeofday(&begin, NULL);
#endif
if (verbose)
gettimeofday(&begin, NULL);
if (stat("checkpoint", &st) == -1)
mkdir("checkpoint", 0700);
@ -1249,12 +1245,13 @@ static void timer_handler(int signum)
fclose(f);
#if CHECKPOINT_VERBOSE
gettimeofday(&end, NULL);
size_t msec = (end.tv_sec - begin.tv_sec) * 1000;
msec += (end.tv_usec - begin.tv_usec) / 1000;
printf("Create checkpoint %u in %zd ms\n", no_checkpoint, msec);
#endif
if (verbose) {
gettimeofday(&end, NULL);
size_t msec = (end.tv_sec - begin.tv_sec) * 1000;
msec += (end.tv_usec - begin.tv_usec) / 1000;
fprintf(stderr, "Create checkpoint %u in %zd ms\n", no_checkpoint, msec);
}
no_checkpoint++;
}