Re: [RFC 7/7] kernel-shark: Add basic example demonstrating the NumPy interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 27, 2019 at 6:04 PM Yordan Karadzhov <ykaradzhov@xxxxxxxxxx> wrote:
>
> The example script plots the distribution (histogram) of the pulseaudio
> wake-up times and finds the biggest latency. The script also generates
> a KernelShark session descriptor file (JSON). The session descriptor file
> can be used by the KernelSherk GUI to open a session which will directly
> visualize the largest wake-up latency.
>
> Signed-off-by: Yordan Karadzhov <ykaradzhov@xxxxxxxxxx>
> ---
>  kernel-shark/bin/sched_wakeup.py | 96 ++++++++++++++++++++++++++++++++
>  1 file changed, 96 insertions(+)
>  create mode 100755 kernel-shark/bin/sched_wakeup.py
>
> diff --git a/kernel-shark/bin/sched_wakeup.py b/kernel-shark/bin/sched_wakeup.py

<snip>

> +while (i >= 0):
> +  if (evt[i] == ss_eid):

Those while (...)s and if (...)s are very C style Python code :)
Usually parentheses are needed only when the expression inside is too
long and one wants to break it on several lines.

Since we don't have a blessed Python style guide, I would suggest
sticking to pep8[1]. There's also a pep8 checker tool[2] which comes
handy and can point out unidiomatic code.

Cheers,

-- Slavi

[1] https://www.python.org/dev/peps/pep-0008/
[2] `apt install pep8` on Debian systems




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux