diff --git a/clients/drcachesim/reader/reader.cpp b/clients/drcachesim/reader/reader.cpp index 1cd157ab44a..783d2a44bb8 100644 --- a/clients/drcachesim/reader/reader.cpp +++ b/clients/drcachesim/reader/reader.cpp @@ -321,8 +321,7 @@ reader_t::process_input_entry() version_ = cur_ref_.marker.marker_value; else if (cur_ref_.marker.marker_type == TRACE_MARKER_TYPE_FILETYPE) { filetype_ = cur_ref_.marker.marker_value; - if (TESTANY(OFFLINE_FILE_TYPE_ENCODINGS, filetype_) && - !TESTANY(OFFLINE_FILE_TYPE_KERNEL_SYSCALLS, filetype_)) { + if (TESTANY(OFFLINE_FILE_TYPE_ENCODINGS, filetype_)) { expect_no_encodings_ = false; } } else if (cur_ref_.marker.marker_type == TRACE_MARKER_TYPE_CACHE_LINE_SIZE) diff --git a/clients/drcachesim/tests/offline-kernel-opcode_mix.templatex b/clients/drcachesim/tests/offline-kernel-opcode-mix.templatex similarity index 100% rename from clients/drcachesim/tests/offline-kernel-opcode_mix.templatex rename to clients/drcachesim/tests/offline-kernel-opcode-mix.templatex diff --git a/clients/drcachesim/tests/offline-kernel-syscall-mix.templatex b/clients/drcachesim/tests/offline-kernel-syscall-mix.templatex new file mode 100644 index 00000000000..82de6c517a0 --- /dev/null +++ b/clients/drcachesim/tests/offline-kernel-syscall-mix.templatex @@ -0,0 +1,6 @@ +Hello, world! +Syscall mix tool results: + syscall count : syscall_num +( *[1-9][0-9]* : *[0-9]*.*)+ + syscall trace count : syscall_num +( *[1-9][0-9]* : *[0-9]*.*)+ diff --git a/clients/drcachesim/tests/offline-syscall-mix.templatex b/clients/drcachesim/tests/offline-syscall-mix.templatex index 231b6bb93d2..a02a9ca3e1e 100644 --- a/clients/drcachesim/tests/offline-syscall-mix.templatex +++ b/clients/drcachesim/tests/offline-syscall-mix.templatex @@ -1,4 +1,4 @@ Hello, world! Syscall mix tool results: - count : syscall_num + syscall count : syscall_num ( *[1-9][0-9]* : *[0-9]*.*)+ diff --git a/clients/drcachesim/tests/syscall-mix.templatex b/clients/drcachesim/tests/syscall-mix.templatex index 59ae08aad9e..e58b2ec7da2 100644 --- a/clients/drcachesim/tests/syscall-mix.templatex +++ b/clients/drcachesim/tests/syscall-mix.templatex @@ -1,5 +1,5 @@ Hello, world! ---- ---- Syscall mix tool results: - count : syscall_num + syscall count : syscall_num ( *[1-9][0-9]* : *[0-9]*.*)+ diff --git a/clients/drcachesim/tools/syscall_mix.cpp b/clients/drcachesim/tools/syscall_mix.cpp index d2b5c90a309..1b9c1d47653 100644 --- a/clients/drcachesim/tools/syscall_mix.cpp +++ b/clients/drcachesim/tools/syscall_mix.cpp @@ -183,7 +183,7 @@ syscall_mix_t::print_results() << keyvals.first << "\n"; } if (!total.syscall_trace_counts.empty()) { - std::cerr << std::setw(15) << "syscall trace count" + std::cerr << std::setw(20) << "syscall trace count" << " : " << std::setw(9) << "syscall_num\n"; std::vector> sorted_trace( total.syscall_trace_counts.begin(), total.syscall_trace_counts.end()); @@ -191,7 +191,7 @@ syscall_mix_t::print_results() for (const auto &keyvals : sorted_trace) { // XXX: It would be nicer to print the system call name string instead // of its number. - std::cerr << std::setw(15) << keyvals.second << " : " << std::setw(9) + std::cerr << std::setw(20) << keyvals.second << " : " << std::setw(9) << keyvals.first << "\n"; } } diff --git a/clients/drcachesim/tracer/raw2trace.cpp b/clients/drcachesim/tracer/raw2trace.cpp index 9de4fb5df49..3c65a61f33e 100644 --- a/clients/drcachesim/tracer/raw2trace.cpp +++ b/clients/drcachesim/tracer/raw2trace.cpp @@ -1044,9 +1044,17 @@ raw2trace_t::process_syscall_pt(raw2trace_thread_data_t *tdata, uint64_t syscall } accumulate_to_statistic(tdata, RAW2TRACE_STAT_SYSCALL_TRACES_DECODED, 1); - std::vector decode_pcs; + app_pc saved_decode_pc; + trace_entry_t entries_with_encodings[WRITE_BUFFER_SIZE]; + trace_entry_t *buf = entries_with_encodings; for (const auto &entry : entries) { if (type_is_instr(static_cast(entry.type))) { + if (buf != entries_with_encodings) { + if (!write(tdata, entries_with_encodings, buf, &saved_decode_pc, 1)) { + return false; + } + buf = entries_with_encodings; + } app_pc instr_pc = reinterpret_cast(entry.addr); accumulate_to_statistic(tdata, RAW2TRACE_STAT_KERNEL_INSTR_COUNT, 1); if (tdata->syscall_pc_to_decode_pc_.find(instr_pc) == @@ -1055,14 +1063,14 @@ raw2trace_t::process_syscall_pt(raw2trace_thread_data_t *tdata, uint64_t syscall "Unknown pc after ir2trace: did ir2trace insert new instr?"; return false; } - decode_pcs.push_back(tdata->syscall_pc_to_decode_pc_[instr_pc].first); + saved_decode_pc = tdata->syscall_pc_to_decode_pc_[instr_pc].first; + if (!append_encoding(tdata, saved_decode_pc, entry.size, buf, + entries_with_encodings)) + return false; } + *buf = entry; + ++buf; } - if (!write(tdata, entries.data(), entries.data() + entries.size(), decode_pcs.data(), - decode_pcs.size())) { - return false; - } - return true; } diff --git a/suite/tests/CMakeLists.txt b/suite/tests/CMakeLists.txt index 8a3d330f7e4..e2149088dd9 100644 --- a/suite/tests/CMakeLists.txt +++ b/suite/tests/CMakeLists.txt @@ -4564,8 +4564,10 @@ if (BUILD_CLIENTS) # tracing flow. torunonly_drcacheoff_kernel(simple ${ci_shared_app} "-raw_compress none" "" "@-simulator_type@basic_counts@-ignore_decode_failure") - torunonly_drcacheoff_kernel(opcode_mix ${ci_shared_app} "-raw_compress none" "" + torunonly_drcacheoff_kernel(opcode-mix ${ci_shared_app} "-raw_compress none" "" "@-simulator_type@opcode_mix@-ignore_decode_failure") + torunonly_drcacheoff_kernel(syscall-mix ${ci_shared_app} "-raw_compress none" "" + "@-simulator_type@syscall_mix") endif (BUILD_PT_TRACER AND BUILD_PT_POST_PROCESSOR) endif (proc_supports_pt)