History

perf script cs_etm: Add map_pgoff to python dictionary

Extract map_pgoff parameter from the dictionary, and adjust start/end range passed to objdump based on the value. A zero start_addr is filtered to prevent output of dso address range check failures. This script repeatedly sees a zero value passed in for       start_addr = cpu_data[str(cpu) + 'addr'] These zero values are not a new problem. The start_addr/stop_addr warning clutters the instruction trace output, hence this change.

Steve Clevenger committed 2 years ago

Commit 26ec3d71 parent 62a6d091 file · +6 −3Browse files

Unified · Split

tools/perf/util/scripting-engines/trace-event-python.c+6−3
@@ -793,7 +793,8 @@ static int set_regs_in_dict(PyObject *dict, · 792 unmodified lines
793static void set_sym_in_dict(PyObject *dict, struct addr_location *al,793static void set_sym_in_dict(PyObject *dict, struct addr_location *al,
794 const char *dso_field, const char *dso_bid_field,794 const char *dso_field, const char *dso_bid_field,
795 const char *dso_map_start, const char *dso_map_end,795 const char *dso_map_start, const char *dso_map_end,
796 const char *sym_field, const char *symoff_field)796 const char *sym_field, const char *symoff_field,
797 const char *map_pgoff)
797{798{
798 char sbuild_id[SBUILD_ID_SIZE];799 char sbuild_id[SBUILD_ID_SIZE];
799 800
@@ -809,6 +810,8 @@ static void set_sym_in_dict(PyObject *dict, struct addr_location *al, · 9 unmodified lines
809 PyLong_FromUnsignedLong(map__start(al->map)));810 PyLong_FromUnsignedLong(map__start(al->map)));
810 pydict_set_item_string_decref(dict, dso_map_end,811 pydict_set_item_string_decref(dict, dso_map_end,
811 PyLong_FromUnsignedLong(map__end(al->map)));812 PyLong_FromUnsignedLong(map__end(al->map)));
813 pydict_set_item_string_decref(dict, map_pgoff,
814 PyLong_FromUnsignedLongLong(map__pgoff(al->map)));
812 }815 }
813 if (al->sym) {816 if (al->sym) {
814 pydict_set_item_string_decref(dict, sym_field,817 pydict_set_item_string_decref(dict, sym_field,
@@ -895,7 +898,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample, · 80 unmodified lines
895 pydict_set_item_string_decref(dict, "comm",898 pydict_set_item_string_decref(dict, "comm",
896 _PyUnicode_FromString(thread__comm_str(al->thread)));899 _PyUnicode_FromString(thread__comm_str(al->thread)));
897 set_sym_in_dict(dict, al, "dso", "dso_bid", "dso_map_start", "dso_map_end",900 set_sym_in_dict(dict, al, "dso", "dso_bid", "dso_map_start", "dso_map_end",
898 "symbol", "symoff");901 "symbol", "symoff", "map_pgoff");
899 902
900 pydict_set_item_string_decref(dict, "callchain", callchain);903 pydict_set_item_string_decref(dict, "callchain", callchain);
901 904
@@ -920,7 +923,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample, · 18 unmodified lines
920 PyBool_FromLong(1));923 PyBool_FromLong(1));
921 set_sym_in_dict(dict_sample, addr_al, "addr_dso", "addr_dso_bid",924 set_sym_in_dict(dict_sample, addr_al, "addr_dso", "addr_dso_bid",
922 "addr_dso_map_start", "addr_dso_map_end",925 "addr_dso_map_start", "addr_dso_map_end",
923 "addr_symbol", "addr_symoff");926 "addr_symbol", "addr_symoff", "addr_map_pgoff");
924 }927 }
925 928
926 if (sample->flags)929 if (sample->flags)