lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7ci_xuVVQM9h3TdT23PsyfM5iHa8x=58k8aPQ=FfaWw8iA@mail.gmail.com>
Date:   Wed, 5 Jul 2023 22:35:02 -0700
From:   Namhyung Kim <namhyung@...nel.org>
To:     Anup Sharma <anupnewsmail@...il.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/7] scripts: python: Extact necessary information from
 process event

Hi Anup,

On Wed, Jul 5, 2023 at 12:42 PM Anup Sharma <anupnewsmail@...il.com> wrote:
>
> The script takes in a sample event dictionary(param_dict) and retrieves
> relevant data such as time stamp, PID, TID, thread name, and call stack
> information. If available, the call stack is parsed to include function
> names and the associated DSO, which are requires for creating json schema.
> Also few libaries has been included which will be used in later commit.
>
> Signed-off-by: Anup Sharma <anupnewsmail@...il.com>
> ---
>  .../scripts/python/firefox-gecko-converter.py | 37 +++++++++++++++++++
>  1 file changed, 37 insertions(+)
>  create mode 100644 tools/perf/scripts/python/firefox-gecko-converter.py
>
> diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools/perf/scripts/python/firefox-gecko-converter.py
> new file mode 100644
> index 000000000000..ce663840d212
> --- /dev/null
> +++ b/tools/perf/scripts/python/firefox-gecko-converter.py
> @@ -0,0 +1,37 @@
> +#!/usr/bin/env python3
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# Usage:
> +#
> +#     perf record -a -g -F 99 sleep 1
> +#     perf script firefox-gecko-converter.py
> +
> +from __future__ import print_function

Is this needed for python3?

> +import os
> +import sys
> +import json
> +from functools import reduce
> +
> +sys.path.append(os.environ['PERF_EXEC_PATH'] + \
> +       '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
> +
> +from perf_trace_context import *
> +from Core import *
> +
> +def process_event(param_dict):
> +       time_stamp = (param_dict['sample']['time'] // 1000) / 1000
> +       pid = param_dict['sample']['pid']
> +       tid = param_dict['sample']['tid']
> +       thread_name = param_dict['comm']
> +       start_time = time_stamp if not start_time else start_time
> +       if param_dict['callchain']:
> +               stack = []
> +               for call in param_dict['callchain']:
> +                       if 'sym' not in call:
> +                               continue
> +                       stack.append(call['sym']['name'] + f' (in {call["dso"]})')
> +               if len(stack) != 0:
> +                       stack = stack[::-1]
> +       else:
> +               mod = param_dict['symbol'] if 'symbol' in param_dict else '[unknown]'

Why is it 'mod' instead of 'sym' or 'func'?

Thanks,
Namhyung


> +               dso = param_dict['dso'] if 'dso' in param_dict else '[unknown]'
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ