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

Function reset_reader

libCacheSim/traceReader/reader.c:486–512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

484}
485
486void reset_reader(reader_t *const reader) {
487 /* rewind the reader back to beginning */
488 long curr_offset = 0;
489 reader->n_read_req = 0;
490
491#ifdef SUPPORT_ZSTD_TRACE
492 if (reader->is_zstd_file) {
493 reset_zstd_reader(reader->zstd_reader_p);
494 if (reader->trace_start_offset > 0) {
495 read_bytes(reader, reader->trace_start_offset);
496 }
497 }
498#endif
499
500 if (reader->trace_type == PLAIN_TXT_TRACE) {
501 fseek(reader->file, 0, SEEK_SET);
502 curr_offset = ftell(reader->file);
503 } else if (reader->trace_type == CSV_TRACE) {
504 csv_reset_reader(reader);
505 curr_offset = ftell(reader->file);
506 } else {
507 reader->mmap_offset = reader->trace_start_offset;
508 curr_offset = reader->mmap_offset;
509 }
510
511 DEBUG("reset reader current offset %ld\n", curr_offset);
512}
513
514int64_t get_num_of_req(reader_t *const reader) {
515 if (reader->n_total_req > 0) return reader->n_total_req;

Callers 12

run_multiple_cachesFunction · 0.85
test_reader_basicFunction · 0.85
test_reader_more1Function · 0.85
_get_lru_hit_cntFunction · 0.85
get_stack_distFunction · 0.85
get_access_distFunction · 0.85
read_first_reqFunction · 0.85
read_last_reqFunction · 0.85
runMethod · 0.85
cal_working_set_sizeFunction · 0.85
gen_miss_fill_vecMethod · 0.85

Calls 3

reset_zstd_readerFunction · 0.85
read_bytesFunction · 0.85
csv_reset_readerFunction · 0.85

Tested by 2

test_reader_basicFunction · 0.68
test_reader_more1Function · 0.68