MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / main

Function main

libCacheSim/bin/traceUtils/tracePrintMain.cpp:12–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include "internal.hpp"
11
12int main(int argc, char *argv[]) {
13 struct arguments args;
14
15 cli::parse_cmd(argc, argv, &args);
16
17 if (args.print_stat) {
18 lcs_print_trace_stat(args.reader);
19 return 0;
20 }
21
22 request_t *req = new_request();
23 read_one_req(args.reader, req);
24
25 bool trace_has_next_access_vtime = req->next_access_vtime != -2;
26
27 if (!args.print_obj_id_only) {
28 if (trace_has_next_access_vtime) {
29 printf("# time,object,size,next_access_vtime\n");
30 } else {
31 printf("# time,object,size\n");
32 }
33 }
34
35 while (req->valid) {
36 if (args.print_obj_id_32bit) {
37 req->obj_id = (uint32_t)req->obj_id;
38 }
39
40 if (args.print_obj_id_only) {
41 printf("%lu\n", (unsigned long)req->obj_id);
42 } else {
43 printf("%lld%c%llu%c%lld", (long long)req->clock_time, args.delimiter, (unsigned long long)req->obj_id, args.delimiter,
44 (long long)req->obj_size);
45 if (trace_has_next_access_vtime) {
46 printf("%c%lld\n", args.delimiter, (long long)req->next_access_vtime);
47 } else {
48 printf("\n");
49 }
50 }
51 read_one_req(args.reader, req);
52 }
53
54 free_request(req);
55
56 return 0;
57}

Callers

nothing calls this directly

Calls 5

lcs_print_trace_statFunction · 0.85
new_requestFunction · 0.85
read_one_reqFunction · 0.85
free_requestFunction · 0.85
parse_cmdFunction · 0.70

Tested by

no test coverage detected