]> Git Repo - J-linux.git/blobdiff - tools/perf/util/scripting-engines/trace-event-python.c
Merge tag 'vfs-6.13-rc7.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
[J-linux.git] / tools / perf / util / scripting-engines / trace-event-python.c
index 6971dd6c231f8316e4adf18b2cd06d9bca6c6321..8bdae066e83972a1de1615d676388af0d4b596a7 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/compiler.h>
 #include <linux/time64.h>
 #ifdef HAVE_LIBTRACEEVENT
-#include <traceevent/event-parse.h>
+#include <event-parse.h>
 #endif
 
 #include "../build-id.h"
@@ -762,6 +762,8 @@ static void regs_map(struct regs_dump *regs, uint64_t mask, const char *arch, ch
        }
 }
 
+#define MAX_REG_SIZE 128
+
 static int set_regs_in_dict(PyObject *dict,
                             struct perf_sample *sample,
                             struct evsel *evsel)
@@ -769,14 +771,7 @@ static int set_regs_in_dict(PyObject *dict,
        struct perf_event_attr *attr = &evsel->core.attr;
        const char *arch = perf_env__arch(evsel__env(evsel));
 
-       /*
-        * Here value 28 is a constant size which can be used to print
-        * one register value and its corresponds to:
-        * 16 chars is to specify 64 bit register in hexadecimal.
-        * 2 chars is for appending "0x" to the hexadecimal value and
-        * 10 chars is for register name.
-        */
-       int size = __sw_hweight64(attr->sample_regs_intr) * 28;
+       int size = (__sw_hweight64(attr->sample_regs_intr) * MAX_REG_SIZE) + 1;
        char *bf = malloc(size);
        if (!bf)
                return -1;
@@ -798,7 +793,8 @@ static int set_regs_in_dict(PyObject *dict,
 static void set_sym_in_dict(PyObject *dict, struct addr_location *al,
                            const char *dso_field, const char *dso_bid_field,
                            const char *dso_map_start, const char *dso_map_end,
-                           const char *sym_field, const char *symoff_field)
+                           const char *sym_field, const char *symoff_field,
+                           const char *map_pgoff)
 {
        char sbuild_id[SBUILD_ID_SIZE];
 
@@ -814,6 +810,8 @@ static void set_sym_in_dict(PyObject *dict, struct addr_location *al,
                        PyLong_FromUnsignedLong(map__start(al->map)));
                pydict_set_item_string_decref(dict, dso_map_end,
                        PyLong_FromUnsignedLong(map__end(al->map)));
+               pydict_set_item_string_decref(dict, map_pgoff,
+                       PyLong_FromUnsignedLongLong(map__pgoff(al->map)));
        }
        if (al->sym) {
                pydict_set_item_string_decref(dict, sym_field,
@@ -900,7 +898,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample,
        pydict_set_item_string_decref(dict, "comm",
                        _PyUnicode_FromString(thread__comm_str(al->thread)));
        set_sym_in_dict(dict, al, "dso", "dso_bid", "dso_map_start", "dso_map_end",
-                       "symbol", "symoff");
+                       "symbol", "symoff", "map_pgoff");
 
        pydict_set_item_string_decref(dict, "callchain", callchain);
 
@@ -925,7 +923,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample,
                        PyBool_FromLong(1));
                set_sym_in_dict(dict_sample, addr_al, "addr_dso", "addr_dso_bid",
                                "addr_dso_map_start", "addr_dso_map_end",
-                               "addr_symbol", "addr_symoff");
+                               "addr_symbol", "addr_symoff", "addr_map_pgoff");
        }
 
        if (sample->flags)
This page took 0.03348 seconds and 4 git commands to generate.