Skip to content

Commit

Permalink
separate ilator instr time profiling and instr update logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Yi Li committed Jan 14, 2022
1 parent 865d7c9 commit f544a48
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/target-sc/ilator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ bool Ilator::GenerateExecuteKernel(const std::string& dir) {
"void {project}::LogInstrSequence(const std::string& instr_name, const long int& exec_time) {{\n"
" instr_log << \"Instr No. \" << std::setw(8) << GetInstrCntr() << '\\t';\n"
" instr_log << instr_name << \" is activated\\t\";\n"
" instr_log << \"exec_time: \" << exec_time * 1e-6 << \" ms\\n\";\n"
" instr_log << \"exec_time: \" << exec_time * 1e-3 << \" us\\n\";\n"
" IncrementInstrCntr();\n"
"}}\n",
fmt::arg("project", GetProjectName()));
Expand All @@ -526,12 +526,12 @@ bool Ilator::GenerateExecuteKernel(const std::string& dir) {
fmt::format_to(
buff,
"if ({valid_func_name}() && {decode_func_name}()) {{\n"
"#ifdef ILATOR_VERBOSE\n"
"#ifdef ILATOR_PROFILING\n"
" auto start = std::chrono::high_resolution_clock::now();\n"
"#endif\n"
" {update_func_name}();\n"
" {child_counter}\n"
"#ifdef ILATOR_VERBOSE\n"
"#ifdef ILATOR_PROFILING\n"
" auto stop = std::chrono::high_resolution_clock::now();\n"
" auto exec_time = std::chrono::duration_cast<std::chrono::nanoseconds>(stop-start).count();\n"
" LogInstrSequence(\"{instr_name}\", exec_time);\n"
Expand Down Expand Up @@ -662,8 +662,8 @@ bool Ilator::GenerateBuildSupport(const std::string& dir) {
"cmake_minimum_required(VERSION 3.14.0)\n"
"project({project} LANGUAGES CXX)\n"
"\n"
"option(ILATOR_VERBOSE \"Enable instruction sequence logging\" OFF)\n"
// "option(ILATOR_INSN_VERBOSE \"Enable instruction state updates logging\" OFF)\n"
"option(ILATOR_PROFILING \"Enable instruction sequence logging and profiling\" OFF)\n"
"option(ILATOR_VERBOSE \"Enable instruction state updates logging\" OFF)\n"
"option(JSON_SUPPORT \"Build JSON parser support\" OFF)\n"
"\n"
"find_package(SystemCLanguage CONFIG REQUIRED)\n"
Expand All @@ -678,8 +678,11 @@ bool Ilator::GenerateBuildSupport(const std::string& dir) {
"\n"
"target_include_directories({project} PRIVATE {dir_include})\n"
"target_link_libraries({project} SystemC::systemc)\n"
"if(${{ILATOR_PROFILING}})\n"
" target_compile_definitions({project} PRIVATE ILATOR_PROFILING)\n"
"endif()\n"
"if(${{ILATOR_VERBOSE}})\n"
" target_compile_definitions({project} PRIVATE ILATOR_VERBOSE)\n"
" target_compile_definitions({project} PRIVATE ILATOR_PROFILING ILATOR_VERBOSE)\n"
"endif()\n"
// "if(${{ILATOR_INSN_VERBOSE}})\n"
// " target_compile_definitions({project} PRIVATE ILATOR_INSN_VERBOSE)\n"
Expand Down

0 comments on commit f544a48

Please sign in to comment.