Coder Social home page Coder Social logo

new 'read' trigger action about uftrace HOT 11 CLOSED

namhyung avatar namhyung commented on September 13, 2024
new 'read' trigger action

from uftrace.

Comments (11)

namhyung avatar namhyung commented on September 13, 2024 1

@honggyukim @Taeung I added --opt-file option (66c6869).

from uftrace.

honggyukim avatar honggyukim commented on September 13, 2024

This is the feature I was waiting for. One of the main purpose of python scripting was to read system wide stats such as rss, but this can handle it better in some specific cases. I also want to run 'read' trigger at the function exit as you mentioned, so we need to think about the interface.

It may be another issue but I would like to simplify some options and trigger actions. Currently, -A serves only for arguments, -R serves only for return values, and -T is for other triggering options at the entry of function. And -F can also provide some trigger actions. Sometimes, I have to provide the same function name many times to provides it to each -A, -R, -T, -F option. We may have to make those simpler way to reduce the repetition.

from uftrace.

honggyukim avatar honggyukim commented on September 13, 2024

One more question is that I'm wondering if maxrss from rusage is the same rss information that can be read from /proc/[pid]/stat. I thought that it's the maximum value.

from uftrace.

Taeung avatar Taeung commented on September 13, 2024

@honggyukim , I also thought the spot of bother you said above.
So we need to implement the config feature for it ?

I thought we can make the config feature like menuconfig of linux kernel IMHO,
and if we do, the config feature(TUI) can utilize symbol information from target program,
but I'm not sure it is great way.. hum..

from uftrace.

namhyung avatar namhyung commented on September 13, 2024

@honggyukim I agree that repeating names for each option is not a great way. Maybe we can just use -T and -R for entry/exit time trigger and provides -F, -N and -A for simpler interface (and compatibility). Thoughts?

from uftrace.

namhyung avatar namhyung commented on September 13, 2024

@Taeung I don't know what do you want to do with the config interface. Do you want to specify functions and their triggers in a config file?

from uftrace.

honggyukim avatar honggyukim commented on September 13, 2024

@Taeung It would be great if we can pass a config file for those setup. I mentioned that we could provide options with $(< config) but it's shell dependent so I prefer to have a config file that contains all the options that we can pass to uftrace. I thought about the structure json like format but it could be anything.

from uftrace.

namhyung avatar namhyung commented on September 13, 2024

Some tools provide a way to read options from a file directly. For example, gcc supports @file option for this.

from uftrace.

Taeung avatar Taeung commented on September 13, 2024

@namhyung , Yes, the config interface I said is for a particular target program, not overall.
I thought if we apply the config interface,
the user can temporally set various options (e.g. trigger, event, filter, arguments, etc.)
with given function names on TUI before recording target execution.

Hum.. temporary setup(to prepare various options) before recording a particular target program ?
or,
As @honggyukim said, if we enable the user to pass a config file for those setup,
additionally I thought uftrace tool can generate a skeleton config file for the user.

But they can be needless, if uftrace tool support the way to read options from a file.. as you said.

from uftrace.

namhyung avatar namhyung commented on September 13, 2024

Update to review/trigger-read-v2.

Changelog:

  • change name to 'proc.statm' to clarify it's reading memory stats from /proc/self/statm
  • add 'proc.page-fault' to show page faults
  • fix segfault when more than 4 events before saving to shmbuf
  • fix a bug on parsing regex pattern
  • drop event after fork()

Example:

$ uftrace  -T b@read=proc.statm  t-abc
# DURATION    TID     FUNCTION
            [32417] | main() {
            [32417] |   a() {
            [32417] |     b() {
            [32417] |       /* read:proc.statm (size=6810KB, rss=785KB, shared=719KB) */
            [32417] |       c() {
   0.479 us [32417] |         getpid();
   3.014 us [32417] |       } /* c */
  16.914 us [32417] |     } /* b */
  17.083 us [32417] |   } /* a */
  17.873 us [32417] | } /* main */

$ uftrace  -T b@read=proc.page-fault  t-abc
# DURATION    TID     FUNCTION
            [32766] | main() {
            [32766] |   a() {
            [32766] |     b() {
            [32766] |       /* read:proc.page-fault (major=0, minor=188) */
            [32766] |       c() {
   0.609 us [32766] |         getpid();
  13.722 us [32766] |       } /* c */
  24.950 us [32766] |     } /* b */
  25.564 us [32766] |   } /* a */
  26.963 us [32766] | } /* main */

from uftrace.

namhyung avatar namhyung commented on September 13, 2024

Update to review/trigger-read-v3.

Changelog:

  • rename to "proc/statm" and "page-fault"
  • honor color setting

Example:

$ uftrace  -T b@read=proc/statm,color=green  t-abc
# DURATION    TID     FUNCTION
   0.819 us [17908] | __monstartup();
   0.475 us [17908] | __cxa_atexit();
            [17908] | main() {
            [17908] |   a() {
            [17908] |     b() {
            [17908] |       /* read:proc/statm (size=6809KB, rss=765KB, shared=701KB) */
            [17908] |       c() {
   0.602 us [17908] |         getpid();
   2.148 us [17908] |       } /* c */
  21.077 us [17908] |     } /* b */
  21.391 us [17908] |   } /* a */
  21.743 us [17908] | } /* main */

$ uftrace  -T b@read=page-fault  t-abc
# DURATION    TID     FUNCTION
   1.167 us [31503] | __monstartup();
   0.870 us [31503] | __cxa_atexit();
            [31503] | main() {
            [31503] |   a() {
            [31503] |     b() {
            [31503] |       /* read:page-fault (major=0, minor=189) */
            [31503] |       c() {
   0.772 us [31503] |         getpid();
   2.780 us [31503] |       } /* c */
   8.254 us [31503] |     } /* b */
   8.661 us [31503] |   } /* a */
   9.212 us [31503] | } /* main */

from uftrace.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.