Skip to content

Commit

Permalink
Several improvments for profiler
Browse files Browse the repository at this point in the history
  • Loading branch information
haugoug committed Dec 19, 2021
1 parent 2974bfd commit d7607c1
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
6 changes: 6 additions & 0 deletions bin/pulp-pc-info
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import argparse
import os
from subprocess import Popen, PIPE
import sys


parser = argparse.ArgumentParser(description='Generate PC debug info')
Expand Down Expand Up @@ -125,6 +126,11 @@ for f in functions:

# And finally generate the output files

if args.allFile is None and args.pcFile is None and args.debugFile is None and args.inlineFile is None:
for f in functions:
f.dumpAll(sys.stdout)


# PC oriented file
if args.allFile != None:
with open(args.allFile, 'w') as file:
Expand Down
1 change: 1 addition & 0 deletions engine/python/gv/gvsoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def gen_config(args, config):

for binary in debug_binaries:
full_config.set('**/debug_binaries', binary + '.debugInfo')
full_config.set('**/binaries', binary)


gvsoc_config_path = os.path.join(config.get_str('gapy/work_dir'), 'gvsoc_config.json')
Expand Down
8 changes: 6 additions & 2 deletions engine/src/trace/trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ void vp::component_trace::new_trace_event_string(std::string name, trace *trace)
trace->name = name;
trace->path = top.get_path() + "/" + name;

trace->width = 0;
trace->is_real = false;
trace->is_string = true;
trace->pending_timestamp = -1;
trace->bytes = 0;
Expand Down Expand Up @@ -409,7 +411,7 @@ void vp::trace_engine::flush_event_traces(int64_t timestamp)
}
else if (current->is_string)
{
//this->vcd_user->event_update_logical(int id, uint8_t *value, uint8_t *flags);
this->vcd_user->event_update_string(timestamp, current->id, (char *)current->buffer);
}
else if (current->width > 8)
{
Expand All @@ -433,7 +435,9 @@ void vp::trace_engine::flush_event_traces(int64_t timestamp)
}
else
{
this->vcd_user->event_update_logical(timestamp, current->id, *current->buffer);
uint64_t value = (uint64_t)*(current->buffer);

this->vcd_user->event_update_logical(timestamp, current->id, value);
}
}
else
Expand Down
3 changes: 2 additions & 1 deletion engine/vp/trace_domain_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void trace_domain::check_trace_active(vp::trace *trace, int event)
{
for (auto &x : events_path_regex)
{
if (x.second->is_path || regexec(x.second->regex, full_path.c_str(), 0, NULL, 0) == 0)
if ((x.second->is_path && x.second->path == full_path) || regexec(x.second->regex, full_path.c_str(), 0, NULL, 0) == 0)
{
std::string file_path = x.second->file_path;
vp::Event_trace *event_trace;
Expand Down Expand Up @@ -462,6 +462,7 @@ void trace_domain::conf_trace(int event, std::string path_str, bool enabled)
const char *file_path = "all.vcd";
const char *path = path_str.c_str();
char *delim = (char *)::index(path, '@');

if (delim)
{
*delim = 0;
Expand Down
1 change: 1 addition & 0 deletions models/cpu/iss/vp/include/iss_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class iss_wrapper : public vp::component, vp::Gdbserver_core
vp::trace inline_trace_event;
vp::trace line_trace_event;
vp::trace file_trace_event;
vp::trace binaries_trace_event;
vp::trace pcer_trace_event[32];
vp::trace insn_trace_event;

Expand Down
6 changes: 6 additions & 0 deletions models/cpu/iss/vp/src/iss_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,7 @@ int iss_wrapper::build()
traces.new_trace_event_string("func", &func_trace_event);
traces.new_trace_event_string("inline_func", &inline_trace_event);
traces.new_trace_event_string("file", &file_trace_event);
traces.new_trace_event_string("binaries", &binaries_trace_event);
traces.new_trace_event("line", &line_trace_event, 32);

traces.new_trace_event_real("ipc_stat", &ipc_stat_event);
Expand Down Expand Up @@ -1423,6 +1424,11 @@ void iss_wrapper::start()
iss_register_debug_info(this, x->get_str().c_str());
}

for (auto x:this->get_js_config()->get("**/binaries")->get_elems())
{
this->binaries_trace_event.event_string("static enable " + x->get_str());
}


trace.msg("ISS start (fetch: %d, is_active: %d, boot_addr: 0x%lx)\n", fetch_enable_reg.get(), is_active_reg.get(), get_config_int("boot_addr"));

Expand Down

0 comments on commit d7607c1

Please sign in to comment.