Skip to contentSkip to conversation

trace-cmd record: add --cpu-list option

PATCH In review Luiz Capitulino 2 participants 8 messages Nov 22, 2016 – Mar 4, 2020 Documentation

lore
Share & tools
lore
#0 lore raw

v2 cover trace-cmd record: add --cpu-list option

This series adds support for a --cpu-list option, which is much more human friendly than -M:

  # trace-cmd record --cpu-list 1,4,10-15 [...]

The first patch is a small refectoring needed to make --cpu-list support fit nicely. The second patch adds the new option.

v2
--

- Use the CPU_SET() API instead of cpu.h, which makes the cpumask dynamic and avoid various bugs
- Small cleanups and renamings

Luiz Capitulino (2):
trace-cmd record: refactor set_mask()
trace-cmd record: add --cpu-list option

 Documentation/trace-cmd-record.1.txt |   4 +
 trace-local.h                        |   2 +-
 trace-record.c                       | 258 ++++++++++++++++++++++++++++++++---
 3 files changed, 245 insertions(+), 19 deletions(-)
Signature · 1 line
2.5.5
#1 lore raw

PATCH v2 1/2 trace-cmd record: refactor set_mask()

This commit makes set_mask() more specialized: all it does now is to write the cpumask to tracing_cpumask. The handling of "-M -1" is now done by the newly added alloc_mask_from_hex().

Also, uneeded checks are dropped and buffer_instance->cpumask points to dynamic memory.

This work is a preparation for supporting the "--cpu-list" option in the next commit.

---
 trace-local.h  |  2 +-
 trace-record.c | 54 ++++++++++++++++++++++++++++++++++--------------------
 2 files changed, 35 insertions(+), 21 deletions(-)
trace-local.h +1 -1
index 62363d0..0ac39bf 100644
@@ -143,7 +143,7 @@ struct func_list {
 struct buffer_instance {
 	struct buffer_instance	*next;
 	const char		*name;
-	const char		*cpumask;
+	char			*cpumask;
 	struct event_list	*events;
 	struct event_list	**event_next;
 
trace-record.c +34 -20

104 lines not on this page · raw message

Signature · 1 line
2.5.5
#2 lore raw

PATCH v2 2/2 trace-cmd record: add --cpu-list option

In reply to Luiz Capitulino

With --cpu-list you can do:

  # trace-cmd record --cpu-list 1,4,10-15 [...]

Which is much more human friendly than -M.

Support for --cpu-list is implemented by dynamically allocating a cpu_set_t object and setting the parsed CPUs. Using the CPU_SET API allows for more robost error detection.

---
 Documentation/trace-cmd-record.1.txt |   4 +
 trace-record.c                       | 208 +++++++++++++++++++++++++++++++++++
 2 files changed, 212 insertions(+)
Documentation/trace-cmd-record.1.txt +4 -0
index b80520e..d7e806a 100644
@@ -304,6 +304,10 @@ OPTIONS
     executed will not be changed. This is useful if you want to monitor the
     output of the command being executed, but not see the output from trace-cmd.
 
+*--cpu-list list*::
+    List of CPUs to be traced. The "list" argument can be comma separated
+    (eg. 1,2,4,5), a range (eg. 1-10) or a mix of the two (eg. 1,2,10-15).
+
 EXAMPLES
 --------
 
trace-record.c +208 -0

238 lines not on this page · raw message

Signature · 1 line
2.5.5
#3 lore raw
In reply to Luiz Capitulino
Quoted 8 lines · On Tue, 22 Nov 2016 15:20:50 -0500 Luiz Capitulino <[email protected]>…

This series adds support for a --cpu-list option, which is much more human friendly than -M:

  # trace-cmd record --cpu-list 1,4,10-15 [...]

The first patch is a small refectoring needed to make --cpu-list support fit nicely. The second patch adds the new option.

ping?

Quoted 17 lines

v2
--

- Use the CPU_SET() API instead of cpu.h, which makes the cpumask dynamic and avoid various bugs
- Small cleanups and renamings

Luiz Capitulino (2):
trace-cmd record: refactor set_mask()
trace-cmd record: add --cpu-list option

 Documentation/trace-cmd-record.1.txt |   4 +
 trace-local.h                        |   2 +-
 trace-record.c                       | 258 ++++++++++++++++++++++++++++++++---
 3 files changed, 245 insertions(+), 19 deletions(-)
#4 lore raw
Quoted 6 lines · On Tue, 3 Jan 2017 11:32:58 -0500 Luiz Capitulino <[email protected]>…
Quoted 3 lines · On Tue, 22 Nov 2016 15:20:50 -0500 Luiz Capitulino <[email protected]>…

This series adds support for a --cpu-list option, which is much more human friendly than -M:

Quoted 8 lines
Quoted 5 lines
  # trace-cmd record --cpu-list 1,4,10-15 [...]

The first patch is a small refectoring needed to make --cpu-list support fit nicely. The second patch adds the new option.

ping?

Thanks for the reminder ;-)

I'm going to try to get to this this week, but as this is my first week on my new job (not to mention the new year), you may need to ping me again.

-- Steve

#5 lore raw
Quoted 15 lines · On Tue, 3 Jan 2017 11:45:30 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 12 lines · On Tue, 3 Jan 2017 11:32:58 -0500 Luiz Capitulino <[email protected]>…
Quoted 8 lines · On Tue, 22 Nov 2016 15:20:50 -0500 Luiz Capitulino <[email protected]>…

This series adds support for a --cpu-list option, which is much more human friendly than -M:

  # trace-cmd record --cpu-list 1,4,10-15 [...]

The first patch is a small refectoring needed to make --cpu-list support fit nicely. The second patch adds the new option.

Quoted 8 lines
Quoted 2 lines

ping?

Thanks for the reminder ;-)

I'm going to try to get to this this week, but as this is my first week on my new job (not to mention the new year), you may need to ping me again.

I see, no rush then.

#6 lore raw

Looking through my inbox, I stumbled on this.

Quoted 21 lines · On Tue, 3 Jan 2017 11:54:06 -0500 Luiz Capitulino <[email protected]>…
Quoted 18 lines · On Tue, 3 Jan 2017 11:45:30 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 14 lines · On Tue, 3 Jan 2017 11:32:58 -0500 Luiz Capitulino <[email protected]>…
Quoted 8 lines · On Tue, 22 Nov 2016 15:20:50 -0500 Luiz Capitulino <[email protected]>…

This series adds support for a --cpu-list option, which is much more human friendly than -M:

  # trace-cmd record --cpu-list 1,4,10-15 [...]

The first patch is a small refectoring needed to make --cpu-list support fit nicely. The second patch adds the new option.

ping?

Quoted 7 lines
Quoted 5 lines

Thanks for the reminder ;-)

I'm going to try to get to this this week, but as this is my first week on my new job (not to mention the new year), you may need to ping me again.

I see, no rush then.

I hope you really meant that, as I really did need another ping.

I think this is a good option to have. I've Cc'd linux-trace-devel, and hopefully we'll get this feature added much sooner than the next 3 years!

-- Steve

#7 lore raw
Quoted 32 lines · Steven Rostedt

Looking through my inbox, I stumbled on this.

Quoted 27 lines · On Tue, 3 Jan 2017 11:54:06 -0500 Luiz Capitulino <[email protected]>…
Quoted 23 lines · On Tue, 3 Jan 2017 11:45:30 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 6 lines · On Tue, 3 Jan 2017 11:32:58 -0500 Luiz Capitulino <[email protected]>…
Quoted 3 lines · On Tue, 22 Nov 2016 15:20:50 -0500 Luiz Capitulino <[email protected]>…

This series adds support for a --cpu-list option, which is much more human friendly than -M:

Quoted 8 lines
Quoted 5 lines
   # trace-cmd record --cpu-list 1,4,10-15 [...]

The first patch is a small refectoring needed to make --cpu-list support fit nicely. The second patch adds the new option.

ping?

Thanks for the reminder ;-)

I'm going to try to get to this this week, but as this is my first week on my new job (not to mention the new year), you may need to ping me again.

Quoted 7 lines
Quoted 1 line

I see, no rush then.

I hope you really meant that, as I really did need another ping.

I think this is a good option to have. I've Cc'd linux-trace-devel, and hopefully we'll get this feature added much sooner than the next 3 years!

That's great to hear! :)

- Luiz