Skip to contentSkip to conversation

perf: Fix few nitpicks in perf-script

PATCH Applied SeongJae Park 3 participants 17 messages May 30, 2017 – Jun 8, 2017 perf events

lore
Share & tools
lore
#0 lore raw

cover perf: Fix few nitpicks in perf-script

This patchset fixes few nitpicks in perf-script code and documents.

SeongJae Park (5):
perf script: Fix outdated comment for perf-trace-python perf-script-python,perl.txt: Fix typos perf-script-python.txt: Polish command examples perf-script-python.txt: Fix wrong code snippets perf-script-python.txt: Apply updated trace_unhandled() definition

 tools/perf/Documentation/perf-script-perl.txt      |  2 +-
 tools/perf/Documentation/perf-script-python.txt    | 23 +++++++++-------------
 .../util/scripting-engines/trace-event-python.c    |  2 +-
 3 files changed, 11 insertions(+), 16 deletions(-)
Signature · 1 line
2.13.0
#1 lore raw

PATCH 1/5 perf script: Fix outdated comment for perf-trace-python

Script that generated by '--gen-script' option contains an outdated comment. It mentions about 'perf-trace-python' document while it has renamed to 'perf-script-python'. This commit fixes the outdated comment.

Fixes 133dc4c39c57 ("perf: Rename 'perf trace' to 'perf script'")
---
 tools/perf/util/scripting-engines/trace-event-python.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/scripting-engines/trace-event-python.c +1 -1
index 9d92af7d0718..40de3cb40d21 100644
@@ -1219,7 +1219,7 @@ static int python_generate_script(struct pevent *pevent, const char *outfile)
 	fprintf(ofp, "# be retrieved using Python functions of the form "
 		"common_*(context).\n");
 
-	fprintf(ofp, "# See the perf-trace-python Documentation for the list "
+	fprintf(ofp, "# See the perf-script-python Documentation for the list "
 		"of available functions.\n\n");
 
 	fprintf(ofp, "import os\n");
Signature · 1 line
2.13.0
maintainer Applied
#2 lore raw

Re: [PATCH 1/5] perf script: Fix outdated comment for perf-trace-python

Em Tue, May 30, 2017 at 08:18:23PM +0900, SeongJae Park escreveu:

Quoted 4 lines

Script that generated by '--gen-script' option contains an outdated comment. It mentions about 'perf-trace-python' document while it has renamed to 'perf-script-python'. This commit fixes the outdated comment.

Thanks, applied to perf/urgent.

- Arnaldo

Quoted 21 lines
Fixes 133dc4c39c57 ("perf: Rename 'perf trace' to 'perf script'")
---
 tools/perf/util/scripting-engines/trace-event-python.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/scripting-engines/trace-event-python.c +1 -1
index 9d92af7d0718..40de3cb40d21 100644
@@ -1219,7 +1219,7 @@ static int python_generate_script(struct pevent *pevent, const char *outfile)
 	fprintf(ofp, "# be retrieved using Python functions of the form "
 		"common_*(context).\n");
 
-	fprintf(ofp, "# See the perf-trace-python Documentation for the list "
+	fprintf(ofp, "# See the perf-script-python Documentation for the list "
 		"of available functions.\n\n");
 
 	fprintf(ofp, "import os\n");
Signature · 1 line
2.13.0
#3 lore raw

[tip:perf/urgent] perf script: Fix outdated comment for perf-trace-python

In reply to SeongJae Park
perf script: Fix outdated comment for perf-trace-python
Commit-ID:  c76132dc5182776b98e946d674cb41c421661ea9
Gitweb:     http://git.kernel.org/tip/c76132dc5182776b98e946d674cb41c421661ea9
Author:     SeongJae Park <[email protected]>
AuthorDate: Tue, 30 May 2017 20:18:23 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 7 Jun 2017 20:23:22 -0300

perf script: Fix outdated comment for perf-trace-python

Script generated by the '--gen-script' option contains an outdated comment. It mentions a 'perf-trace-python' document while it has been renamed to 'perf-script-python'. Fix it.

Cc Alexander Shishkin <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Fixes 133dc4c39c57 ("perf: Rename 'perf trace' to 'perf script'")
---
 tools/perf/util/scripting-engines/trace-event-python.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/scripting-engines/trace-event-python.c +1 -1
index 9d92af7..40de3cb 100644
@@ -1219,7 +1219,7 @@ static int python_generate_script(struct pevent *pevent, const char *outfile)
 	fprintf(ofp, "# be retrieved using Python functions of the form "
 		"common_*(context).\n");
 
-	fprintf(ofp, "# See the perf-trace-python Documentation for the list "
+	fprintf(ofp, "# See the perf-script-python Documentation for the list "
 		"of available functions.\n\n");
 
 	fprintf(ofp, "import os\n");
#4 lore raw

PATCH 2/5 perf-script-python,perl.txt: Fix typos

In reply to SeongJae Park

This commit fixes two typos in documents for perf-script-python and perf-script-perl as below:

- /sys/kernel/debug/tracing events -> /sys/kernel/debug/tracing/events/
- trace_handled -> trace_unhandled

Fixes cff68e582237 ("perf/scripts: Add perf-trace-python Documentation")
---
 tools/perf/Documentation/perf-script-perl.txt   | 2 +-
 tools/perf/Documentation/perf-script-python.txt | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-script-perl.txt +1 -1
index dfbb506d2c34..142606c0ec9c 100644
@@ -39,7 +39,7 @@ EVENT HANDLERS
 When perf script is invoked using a trace script, a user-defined
 'handler function' is called for each event in the trace.  If there's
 no handler function defined for a given event type, the event is
-ignored (or passed to a 'trace_handled' function, see below) and the
+ignored (or passed to a 'trace_unhandled' function, see below) and the
 next event is processed.
 
 Most of the event's field values are passed as arguments to the
tools/perf/Documentation/perf-script-python.txt +2 -2
index 54acba221558..087b87c956ba 100644
@@ -321,7 +321,7 @@ So those are the essential steps in writing and running a script.  The
 process can be generalized to any tracepoint or set of tracepoints
 you're interested in - basically find the tracepoint(s) you're
 interested in by looking at the list of available events shown by
-'perf list' and/or look in /sys/kernel/debug/tracing events for
+'perf list' and/or look in /sys/kernel/debug/tracing/events/ for
 detailed event and field info, record the corresponding trace data
 using 'perf record', passing it the list of interesting events,
 generate a skeleton script using 'perf script -g python' and modify the
@@ -437,7 +437,7 @@ EVENT HANDLERS
 When perf script is invoked using a trace script, a user-defined
 'handler function' is called for each event in the trace.  If there's
 no handler function defined for a given event type, the event is
-ignored (or passed to a 'trace_handled' function, see below) and the
+ignored (or passed to a 'trace_unhandled' function, see below) and the
 next event is processed.
 
 Most of the event's field values are passed as arguments to the
Signature · 1 line
2.13.0
maintainer Applied
#5 lore raw

Re: [PATCH 2/5] perf-script-python,perl.txt: Fix typos

Em Tue, May 30, 2017 at 08:18:24PM +0900, SeongJae Park escreveu:

Quoted 5 lines

This commit fixes two typos in documents for perf-script-python and perf-script-perl as below:

- /sys/kernel/debug/tracing events -> /sys/kernel/debug/tracing/events/
- trace_handled -> trace_unhandled

Thanks, applied to perf/urgent.

- Arnaldo

Quoted 44 lines
Fixes cff68e582237 ("perf/scripts: Add perf-trace-python Documentation")
---
 tools/perf/Documentation/perf-script-perl.txt   | 2 +-
 tools/perf/Documentation/perf-script-python.txt | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-script-perl.txt +1 -1
index dfbb506d2c34..142606c0ec9c 100644
@@ -39,7 +39,7 @@ EVENT HANDLERS
 When perf script is invoked using a trace script, a user-defined
 'handler function' is called for each event in the trace.  If there's
 no handler function defined for a given event type, the event is
-ignored (or passed to a 'trace_handled' function, see below) and the
+ignored (or passed to a 'trace_unhandled' function, see below) and the
 next event is processed.
 
 Most of the event's field values are passed as arguments to the
tools/perf/Documentation/perf-script-python.txt +2 -2
index 54acba221558..087b87c956ba 100644
@@ -321,7 +321,7 @@ So those are the essential steps in writing and running a script.  The
 process can be generalized to any tracepoint or set of tracepoints
 you're interested in - basically find the tracepoint(s) you're
 interested in by looking at the list of available events shown by
-'perf list' and/or look in /sys/kernel/debug/tracing events for
+'perf list' and/or look in /sys/kernel/debug/tracing/events/ for
 detailed event and field info, record the corresponding trace data
 using 'perf record', passing it the list of interesting events,
 generate a skeleton script using 'perf script -g python' and modify the
@@ -437,7 +437,7 @@ EVENT HANDLERS
 When perf script is invoked using a trace script, a user-defined
 'handler function' is called for each event in the trace.  If there's
 no handler function defined for a given event type, the event is
-ignored (or passed to a 'trace_handled' function, see below) and the
+ignored (or passed to a 'trace_unhandled' function, see below) and the
 next event is processed.
 
 Most of the event's field values are passed as arguments to the
Signature · 1 line
2.13.0
#6 lore raw

[tip:perf/urgent] perf script: Fix documentation errors

In reply to SeongJae Park
perf script: Fix documentation errors
Commit-ID:  34d4453dac257be53c21abf2f713c992fb692b5c
Gitweb:     http://git.kernel.org/tip/34d4453dac257be53c21abf2f713c992fb692b5c
Author:     SeongJae Park <[email protected]>
AuthorDate: Tue, 30 May 2017 20:18:24 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 7 Jun 2017 20:27:20 -0300

perf script: Fix documentation errors

This commit fixes two errors in documents for perf-script-python and perf-script-perl as below:

- /sys/kernel/debug/tracing events -> /sys/kernel/debug/tracing/events/
- trace_handled -> trace_unhandled

Cc Alexander Shishkin <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Tom Zanussi <[email protected]>
Fixes cff68e582237 ("perf/scripts: Add perf-trace-python Documentation")
---
 tools/perf/Documentation/perf-script-perl.txt   | 2 +-
 tools/perf/Documentation/perf-script-python.txt | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-script-perl.txt +1 -1
index dfbb506..142606c 100644
@@ -39,7 +39,7 @@ EVENT HANDLERS
 When perf script is invoked using a trace script, a user-defined
 'handler function' is called for each event in the trace.  If there's
 no handler function defined for a given event type, the event is
-ignored (or passed to a 'trace_handled' function, see below) and the
+ignored (or passed to a 'trace_unhandled' function, see below) and the
 next event is processed.
 
 Most of the event's field values are passed as arguments to the
tools/perf/Documentation/perf-script-python.txt +2 -2
index 54acba2..087b87c9 100644
@@ -321,7 +321,7 @@ So those are the essential steps in writing and running a script.  The
 process can be generalized to any tracepoint or set of tracepoints
 you're interested in - basically find the tracepoint(s) you're
 interested in by looking at the list of available events shown by
-'perf list' and/or look in /sys/kernel/debug/tracing events for
+'perf list' and/or look in /sys/kernel/debug/tracing/events/ for
 detailed event and field info, record the corresponding trace data
 using 'perf record', passing it the list of interesting events,
 generate a skeleton script using 'perf script -g python' and modify the
@@ -437,7 +437,7 @@ EVENT HANDLERS
 When perf script is invoked using a trace script, a user-defined
 'handler function' is called for each event in the trace.  If there's
 no handler function defined for a given event type, the event is
-ignored (or passed to a 'trace_handled' function, see below) and the
+ignored (or passed to a 'trace_unhandled' function, see below) and the
 next event is processed.
 
 Most of the event's field values are passed as arguments to the
#7 lore raw

PATCH 3/5 perf-script-python.txt: Polish command examples

In reply to SeongJae Park

Few shell command examples in perf-script-python.txt has few nitpicks include:

- tools/perf/scripts/python directory listing command is unnecessarily repeated.
- few examples contain additional information in command prompt unnecessarily and inconsistently.

This commit fixes them to enhance readability of the document.

Fixes cff68e582237 ("perf/scripts: Add perf-trace-python Documentation")
---
 tools/perf/Documentation/perf-script-python.txt | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tools/perf/Documentation/perf-script-python.txt +2 -4
index 087b87c956ba..44e51351536f 100644
@@ -334,7 +334,7 @@ right place, you can have your script listed alongside the other
 scripts listed by the 'perf script -l' command e.g.:
 
 ----
-root@tropicana:~# perf script -l
+# perf script -l
 List of available trace scripts:
   wakeup-latency                       system-wide min/max/avg wakeup latency
   rw-by-file <comm>                    r/w activity for a program, by file
@@ -383,8 +383,6 @@ source tree:
 
 ----
 # ls -al kernel-source/tools/perf/scripts/python
-
-root@tropicana:/home/trz/src/tip# ls -al tools/perf/scripts/python
 total 32
 drwxr-xr-x 4 trz trz 4096 2010-01-26 22:30 .
 drwxr-xr-x 4 trz trz 4096 2010-01-26 22:29 ..
@@ -399,7 +397,7 @@ otherwise your script won't show up at run-time), 'perf script -l'
 should show a new entry for your script:
 
 ----
-root@tropicana:~# perf script -l
+# perf script -l
 List of available trace scripts:
   wakeup-latency                       system-wide min/max/avg wakeup latency
   rw-by-file <comm>                    r/w activity for a program, by file
Signature · 1 line
2.13.0
#8 lore raw

[tip:perf/urgent] perf script python: Remove dups in documentation examples

perf script python: Remove dups in documentation examples
Commit-ID:  14fc42fa1b3e7ea5160c84d0e686a3a0c1ffe619
Gitweb:     http://git.kernel.org/tip/14fc42fa1b3e7ea5160c84d0e686a3a0c1ffe619
Author:     SeongJae Park <[email protected]>
AuthorDate: Tue, 30 May 2017 20:18:25 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 7 Jun 2017 20:36:12 -0300

perf script python: Remove dups in documentation examples

Few shell command examples in perf-script-python.txt has few nitpicks include:

- tools/perf/scripts/python directory listing command is unnecessarily repeated.
- few examples contain additional information in command prompt unnecessarily and inconsistently.

This commit fixes them to enhance readability of the document.

Cc Alexander Shishkin <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Tom Zanussi <[email protected]>
Fixes cff68e582237 ("perf/scripts: Add perf-trace-python Documentation")
---
 tools/perf/Documentation/perf-script-python.txt | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tools/perf/Documentation/perf-script-python.txt +2 -4
index 378783f..51ec2d2 100644
@@ -332,7 +332,7 @@ right place, you can have your script listed alongside the other
 scripts listed by the 'perf script -l' command e.g.:
 
 ----
-root@tropicana:~# perf script -l
+# perf script -l
 List of available trace scripts:
   wakeup-latency                       system-wide min/max/avg wakeup latency
   rw-by-file <comm>                    r/w activity for a program, by file
@@ -381,8 +381,6 @@ source tree:
 
 ----
 # ls -al kernel-source/tools/perf/scripts/python
-
-root@tropicana:/home/trz/src/tip# ls -al tools/perf/scripts/python
 total 32
 drwxr-xr-x 4 trz trz 4096 2010-01-26 22:30 .
 drwxr-xr-x 4 trz trz 4096 2010-01-26 22:29 ..
@@ -397,7 +395,7 @@ otherwise your script won't show up at run-time), 'perf script -l'
 should show a new entry for your script:
 
 ----
-root@tropicana:~# perf script -l
+# perf script -l
 List of available trace scripts:
   wakeup-latency                       system-wide min/max/avg wakeup latency
   rw-by-file <comm>                    r/w activity for a program, by file
#9 lore raw

PATCH 4/5 perf-script-python.txt: Fix wrong code snippets

In reply to SeongJae Park

This commit fixes wrong code snippets for trace_begin() and trace_end() function example definition.

---
 tools/perf/Documentation/perf-script-python.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/Documentation/perf-script-python.txt +2 -2
index 44e51351536f..f723ce41268c 100644
@@ -530,7 +530,7 @@ can implement a set of optional functions:
 gives scripts a chance to do setup tasks:
 
 ----
-def trace_begin:
+def trace_begin():
     pass
 ----
 
@@ -539,7 +539,7 @@ def trace_begin:
  as display results:
 
 ----
-def trace_end:
+def trace_end():
     pass
 ----
 
Signature · 1 line
2.13.0
#10 lore raw

Re: [PATCH 4/5] perf-script-python.txt: Fix wrong code snippets

Em Tue, May 30, 2017 at 08:18:26PM +0900, SeongJae Park escreveu:

Quoted 2 lines

This commit fixes wrong code snippets for trace_begin() and trace_end() function example definition.

Fixed, and using:

  git log --follow tools/perf/Documentation/perf-script-python.txt

Added the Fixes: tag:

Fixes cff68e582237 ("perf/scripts: Add perf-trace-python Documentation")

And since you're taking the time to add the Fixes tag (yay, great!) please also add Cc: entries for the patch author and committer, in that case:

Cc Tom Zanussi <[email protected]>
Cc Frederic Weisbecker <[email protected]>

I did it this time, using a script I have:

[acme@jouet linux]$ cat ~/bin/fixes
#!/bin/bash

cset=$1
if [ $# -eq 0 ] ; then
read cset
fi
git show --pretty=fuller $cset | grep '^\(Author\|Commit\): ' | sed -r 's/.*: +/Cc: /g' echo Fixes: git one $cset
[acme@jouet linux]$

Just get the cset, in vim, and select it, pressing Shift+V while the cursor is on top of the cset id and then press : and finally !fixes + ENTER :)

cff68e582237

- Arnaldo

Quoted 29 lines
---
 tools/perf/Documentation/perf-script-python.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/Documentation/perf-script-python.txt +2 -2
index 44e51351536f..f723ce41268c 100644
@@ -530,7 +530,7 @@ can implement a set of optional functions:
 gives scripts a chance to do setup tasks:
 
 ----
-def trace_begin:
+def trace_begin():
     pass
 ----
 
@@ -539,7 +539,7 @@ def trace_begin:
  as display results:
 
 ----
-def trace_end:
+def trace_end():
     pass
 ----
 
Signature · 1 line
2.13.0
#11 lore raw

Re: [PATCH 4/5] perf-script-python.txt: Fix wrong code snippets

Quoted 8 lines · Arnaldo Carvalho de Melo

Em Tue, May 30, 2017 at 08:18:26PM +0900, SeongJae Park escreveu:

Quoted 2 lines

This commit fixes wrong code snippets for trace_begin() and trace_end() function example definition.

Fixed, and using:

  git log --follow tools/perf/Documentation/perf-script-python.txt
Quoted 7 lines

Added the Fixes: tag:

Fixes cff68e582237 ("perf/scripts: Add perf-trace-python Documentation")

And since you're taking the time to add the Fixes tag (yay, great!) please also add Cc: entries for the patch author and committer, in that case:

Ok, I will do that from next time.

Quoted 17 lines
Cc Tom Zanussi <[email protected]>
Cc Frederic Weisbecker <[email protected]>

I did it this time, using a script I have:

[acme@jouet linux]$ cat ~/bin/fixes
#!/bin/bash

cset=$1
if [ $# -eq 0 ] ; then
read cset
fi
git show --pretty=fuller $cset | grep '^\(Author\|Commit\): ' | sed -r 's/.*: +/Cc: /g' echo Fixes: git one $cset
[acme@jouet linux]$

Quoted 5 lines

Just get the cset, in vim, and select it, pressing Shift+V while the cursor is on top of the cset id and then press : and finally !fixes + ENTER :)

cff68e582237

So sweet script! :D

Thanks,
SeongJae Park

Quoted 32 lines

- Arnaldo

Quoted 29 lines
---
 tools/perf/Documentation/perf-script-python.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/Documentation/perf-script-python.txt +2 -3
index 44e51351536f..f723ce41268c 100644
@@ -530,7 +530,7 @@ can implement a set of optional functions:
 gives scripts a chance to do setup tasks:
 
 ----
-def trace_begin:
+def trace_begin():
     pass
 ----
 
@@ -539,7 +539,7 @@ def trace_begin:
  as display results:
 
 ----
-def trace_end:
+def trace_end():
     pass
 ----
 
--

2.13.0

#12 lore raw

[tip:perf/urgent] perf script python: Fix wrong code snippets in documentation

In reply to SeongJae Park
perf script python: Fix wrong code snippets in documentation
Commit-ID:  26ddb8722df865aa67fbe459107d2f3f8e5c6829
Gitweb:     http://git.kernel.org/tip/26ddb8722df865aa67fbe459107d2f3f8e5c6829
Author:     SeongJae Park <[email protected]>
AuthorDate: Tue, 30 May 2017 20:18:26 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 7 Jun 2017 20:27:26 -0300

perf script python: Fix wrong code snippets in documentation

This commit fixes wrong code snippets for trace_begin() and trace_end() function example definition.

Cc Alexander Shishkin <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Tom Zanussi <[email protected]>
Fixes cff68e582237 ("perf/scripts: Add perf-trace-python Documentation")
---
 tools/perf/Documentation/perf-script-python.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/Documentation/perf-script-python.txt +2 -2
index 087b87c9..bad6e93 100644
@@ -532,7 +532,7 @@ can implement a set of optional functions:
 gives scripts a chance to do setup tasks:
 
 ----
-def trace_begin:
+def trace_begin():
     pass
 ----
 
@@ -541,7 +541,7 @@ def trace_begin:
  as display results:
 
 ----
-def trace_end:
+def trace_end():
     pass
 ----
 
#13 lore raw

PATCH 5/5 perf-script-python.txt: Apply updated trace_unhandled() definition

In reply to SeongJae Park

Default definition of trace_unhandled() has updated while perf-script-python.txt has not updated. This commit updates the document for that.

Fixes c02514850d67b ("perf scripts python: Give field dict to unhandled callback")
---
 tools/perf/Documentation/perf-script-python.txt | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
tools/perf/Documentation/perf-script-python.txt +3 -6
index f723ce41268c..51ec2d20068a 100644
@@ -149,10 +149,8 @@ def raw_syscalls__sys_enter(event_name, context, common_cpu,
 		print "id=%d, args=%s\n" % \
 		(id, args),
 
-def trace_unhandled(event_name, context, common_cpu, common_secs, common_nsecs,
-		common_pid, common_comm):
-		print_header(event_name, common_cpu, common_secs, common_nsecs,
-		common_pid, common_comm)
+def trace_unhandled(event_name, context, event_fields_dict):
+		print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())])
 
 def print_header(event_name, cpu, secs, nsecs, pid, comm):
 	print "%-20s %5u %05u.%09u %8u %-20s " % \
@@ -548,8 +546,7 @@ def trace_end():
  of common arguments are passed into it:
 
 ----
-def trace_unhandled(event_name, context, common_cpu, common_secs,
-        common_nsecs, common_pid, common_comm):
+def trace_unhandled(event_name, context, event_fields_dict):
     pass
 ----
 
Signature · 1 line
2.13.0
maintainer Applied
#14 lore raw

Re: [PATCH 5/5] perf-script-python.txt: Apply updated trace_unhandled() definition

Em Tue, May 30, 2017 at 08:18:27PM +0900, SeongJae Park escreveu:

Quoted 3 lines

Default definition of trace_unhandled() has updated while perf-script-python.txt has not updated. This commit updates the document for that.

Thanks, applied to perf/urgent.

- Arnaldo

Quoted 35 lines
Fixes c02514850d67b ("perf scripts python: Give field dict to unhandled callback")
---
 tools/perf/Documentation/perf-script-python.txt | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
tools/perf/Documentation/perf-script-python.txt +3 -6
index f723ce41268c..51ec2d20068a 100644
@@ -149,10 +149,8 @@ def raw_syscalls__sys_enter(event_name, context, common_cpu,
 		print "id=%d, args=%s\n" % \
 		(id, args),
 
-def trace_unhandled(event_name, context, common_cpu, common_secs, common_nsecs,
-		common_pid, common_comm):
-		print_header(event_name, common_cpu, common_secs, common_nsecs,
-		common_pid, common_comm)
+def trace_unhandled(event_name, context, event_fields_dict):
+		print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())])
 
 def print_header(event_name, cpu, secs, nsecs, pid, comm):
 	print "%-20s %5u %05u.%09u %8u %-20s " % \
@@ -548,8 +546,7 @@ def trace_end():
  of common arguments are passed into it:
 
 ----
-def trace_unhandled(event_name, context, common_cpu, common_secs,
-        common_nsecs, common_pid, common_comm):
+def trace_unhandled(event_name, context, event_fields_dict):
     pass
 ----
 
Signature · 1 line
2.13.0
#15 lore raw

[tip:perf/urgent] perf script python: Updated trace_unhandled() signature

In reply to SeongJae Park
perf script python: Updated trace_unhandled() signature
Commit-ID:  1bf8d5a4a5da19b1f6e7958fe67db4118fa7a1c1
Gitweb:     http://git.kernel.org/tip/1bf8d5a4a5da19b1f6e7958fe67db4118fa7a1c1
Author:     SeongJae Park <[email protected]>
AuthorDate: Tue, 30 May 2017 20:18:27 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 7 Jun 2017 20:27:32 -0300

perf script python: Updated trace_unhandled() signature

Default function signature of trace_unhandled() got changed to include a field dict, but its documentation, perf-script-python.txt has not been updated. Fix it.

Cc Alexander Shishkin <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Pierre Tardy <[email protected]>
Fixes c02514850d67 ("perf scripts python: Give field dict to unhandled callback")
---
 tools/perf/Documentation/perf-script-python.txt | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
tools/perf/Documentation/perf-script-python.txt +3 -6
index bad6e93..378783f 100644
@@ -149,10 +149,8 @@ def raw_syscalls__sys_enter(event_name, context, common_cpu,
 		print "id=%d, args=%s\n" % \
 		(id, args),
 
-def trace_unhandled(event_name, context, common_cpu, common_secs, common_nsecs,
-		common_pid, common_comm):
-		print_header(event_name, common_cpu, common_secs, common_nsecs,
-		common_pid, common_comm)
+def trace_unhandled(event_name, context, event_fields_dict):
+		print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())])
 
 def print_header(event_name, cpu, secs, nsecs, pid, comm):
 	print "%-20s %5u %05u.%09u %8u %-20s " % \
@@ -550,8 +548,7 @@ def trace_end():
  of common arguments are passed into it:
 
 ----
-def trace_unhandled(event_name, context, common_cpu, common_secs,
-        common_nsecs, common_pid, common_comm):
+def trace_unhandled(event_name, context, event_fields_dict):
     pass
 ----
 
#16 lore raw
In reply to SeongJae Park

Hi, may I ask some comments?

Quoted 18 lines · SeongJae Park

This patchset fixes few nitpicks in perf-script code and documents.

SeongJae Park (5):
perf script: Fix outdated comment for perf-trace-python perf-script-python,perl.txt: Fix typos perf-script-python.txt: Polish command examples perf-script-python.txt: Fix wrong code snippets perf-script-python.txt: Apply updated trace_unhandled() definition

tools/perf/Documentation/perf-script-perl.txt      |  2 +-
tools/perf/Documentation/perf-script-python.txt    | 23 +++++++++-------------
.../util/scripting-engines/trace-event-python.c    |  2 +-
3 files changed, 11 insertions(+), 16 deletions(-)
Signature · 1 line
2.13.0