add magic number

This commit is contained in:
quackerd 2023-03-05 15:15:13 +01:00
parent a9cac61069
commit 521a49d945

View File

@ -28,7 +28,8 @@ usage()
" -i: inter arrival time distribution\n"
" -o: output file path\n"
" -H: history size for pct adjustment\n"
" -w: warmup time before pct adjustment\n");
" -w: warmup time before pct adjustment\n"
" -M: print this string when threads are ready to run\n");
fflush(stdout);
}
@ -45,6 +46,7 @@ int main(int argc, char * argv[])
uint64_t transaction_size = arr_sz;
cpuset_t threads;
uint32_t pct = 0;
char magic[256] = {0};
CPU_ZERO(&threads);
CPU_SET(0, &threads);
char ia_dist[32] = "fixed";
@ -59,7 +61,7 @@ int main(int argc, char * argv[])
{
int c;
// parse arguments
while ((c = getopt(argc, argv, "vhb:d:s:So:T:t:q:i:p:H:w:")) != -1) {
while ((c = getopt(argc, argv, "vhb:d:s:So:T:t:q:i:p:H:w:M:")) != -1) {
switch (c) {
case 'v':
ntr_set_level(NTR_DEP_USER1, ntr_get_level(NTR_DEP_USER1) + 1);
@ -103,6 +105,9 @@ int main(int argc, char * argv[])
case 'w':
warmup = strtol(optarg, nullptr, 10);
break;
case 'M':
strncpy(magic, optarg, sizeof(magic));
break;
default:
usage();
exit(0);
@ -147,11 +152,14 @@ int main(int argc, char * argv[])
opts.transaction_size = transaction_size;
opts.verbose = ntr_get_level(NTR_DEP_USER1) != NTR_LEVEL_DEFAULT;
strncpy(opts.ia_dist, ia_dist, sizeof(opts.ia_dist));
std::ofstream ofile;
ofile.open(output_file, std::ios::out | std::ios::trunc);
auto mgen = new memload_generator(&threads, &domain_mask, &opts, &success);
if (strlen(magic) > 0) {
fprintf(stdout, "%s\n", magic);
fflush(stdout);
}
if (!mgen->start()) {
fprintf(stderr, "failed to start memloadgen!\n");
exit(1);