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
793793 static void set_sym_in_dict(PyObject *dict, struct addr_location *al,
794794 const char *dso_field, const char *dso_bid_field,
795795 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)
797798 {
798799 char sbuild_id[SBUILD_ID_SIZE];
799800
@@ -809,6 +810,8 @@ static void set_sym_in_dict(PyObject *dict, struct addr_location *al, · 9 unmodified lines
809810 PyLong_FromUnsignedLong(map__start(al->map)));
810811 pydict_set_item_string_decref(dict, dso_map_end,
811812 PyLong_FromUnsignedLong(map__end(al->map)));
813+ pydict_set_item_string_decref(dict, map_pgoff,
814+ PyLong_FromUnsignedLongLong(map__pgoff(al->map)));
812815 }
813816 if (al->sym) {
814817 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
895898 pydict_set_item_string_decref(dict, "comm",
896899 _PyUnicode_FromString(thread__comm_str(al->thread)));
897900 set_sym_in_dict(dict, al, "dso", "dso_bid", "dso_map_start", "dso_map_end",
898− "symbol", "symoff");
901+ "symbol", "symoff", "map_pgoff");
899902
900903 pydict_set_item_string_decref(dict, "callchain", callchain);
901904
@@ -920,7 +923,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample, · 18 unmodified lines
920923 PyBool_FromLong(1));
921924 set_sym_in_dict(dict_sample, addr_al, "addr_dso", "addr_dso_bid",
922925 "addr_dso_map_start", "addr_dso_map_end",
923− "addr_symbol", "addr_symoff");
926+ "addr_symbol", "addr_symoff", "addr_map_pgoff");
924927 }
925928
926929 if (sample->flags)