Skip to contentSkip to conversation

Changing frequency rate to perf mem

DISCUSSION Harald Servat 3 participants 5 messages Oct 23, 2013 – Oct 28, 2013

lore
Share & tools
lore
#0 lore raw

Hello list,

I'm interested on changing the frequency rate to the perf mem tool. I
understand that this tool captures the data every N loads or stores, however I don't see how to tune N.

I've looked into builtin-record.c approx line 980 and I found that
changing rec->opts.freq allows me capturing more or less data. Initially, its value is 4000 and generates 4.5Mbytes for an application. If I modify this value to 200, it generates 0.2Mbytes, therefore 200/4000 is closely 0.2/4.5 which seems the value I want to tune.

I'd like to know what is this rec->opts.freq with respect to perf
mem. I expected to setup the number of loads, therefore the higher N the lesser number of samples generated, but it seems the other way around. Where I can get any hint on what does this mean.

BTW, I tried to change this value by adding "-F" and "200" into the
argv that is passed to cmd_report by adding

        rec_argv[i++] = strdup("-F");
        rec_argv[i++] = strdup("200");

into line 42 of perf-mem.c - just after the strdup("record").
Unfortunately, this seems to break something and perf segfaults often. Which is the most appropriate way to tune the user frequency of perf mem?

Thank you very much in advance!

Signature · 11 lines
WARNING / LEGAL TEXT: This message is intended only for the use of the
individual or entity to which it is addressed and may contain
information which is privileged, confidential, proprietary, or exempt
from disclosure under applicable law. If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, you are strictly prohibited from disclosing,
distributing, copying, or in any way using this message. If you have
received this communication in error, please notify the sender and
destroy and delete any copies you may have received.

http://www.bsc.es/disclaimer
#1 lore raw
Quoted 9 lines · Harald Servat

BTW, I tried to change this value by adding "-F" and "200" into the
argv that is passed to cmd_report by adding

        rec_argv[i++] = strdup("-F");
        rec_argv[i++] = strdup("200");

into line 42 of perf-mem.c - just after the
strdup("record").

You would need to increase the array size too.

Quoted 3 lines

Unfortunately, this seems to break something and
perf segfaults often. Which is the most appropriate way to tune the user frequency of perf mem?

Best would be probably to fix it to pass through unknown options, then -F/-c could be just used. I'm not sure if this is possible easily with the git option parser.

Alternatively you can just specify the command line perf mem record would specify directly to perf record, plus -c/-F

-andi

Signature · 1 line
[email protected] -- Speaking for myself only
#2 lore raw
Quoted 5 lines · Andi Kleen
Quoted 4 lines · Harald Servat

BTW, I tried to change this value by adding "-F" and "200" into the
argv that is passed to cmd_report by adding

Quoted 7 lines
Quoted 5 lines
         rec_argv[i++] = strdup("-F");
         rec_argv[i++] = strdup("200");

into line 42 of perf-mem.c - just after the
strdup("record").

You would need to increase the array size too.

Ouch! You're right! I forgot that!

Quoted 8 lines
Quoted 4 lines

Unfortunately, this seems to break something and
perf segfaults often. Which is the most appropriate way to tune the user frequency of perf mem?

Best would be probably to fix it to pass through unknown options, then -F/-c could be just used. I'm not sure if this is possible easily with the git option parser.

Sorry, I'm not sure what is the "git option parser" here.
I think that this could be implemented extending the mem_options[] in file builtin-mem.c lines 205-221.

Quoted 5 lines

Alternatively you can just specify the command line perf mem record would specify directly to perf record, plus -c/-F

-andi

Thank you very much Andi.

Signature · 11 lines
WARNING / LEGAL TEXT: This message is intended only for the use of the
individual or entity to which it is addressed and may contain
information which is privileged, confidential, proprietary, or exempt
from disclosure under applicable law. If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, you are strictly prohibited from disclosing,
distributing, copying, or in any way using this message. If you have
received this communication in error, please notify the sender and
destroy and delete any copies you may have received.

http://www.bsc.es/disclaimer
#3 lore raw

Hi Harald,

Quoted 11 lines · Harald Servat
Quoted 8 lines · Andi Kleen
Quoted 3 lines · Harald Servat

Unfortunately, this seems to break something and
perf segfaults often. Which is the most appropriate way to tune the user frequency of perf mem?

Best would be probably to fix it to pass through unknown options, then -F/-c could be just used. I'm not sure if this is possible easily with the git option parser.

Sorry, I'm not sure what is the "git option parser" here.

Just implementation details. The source code of the option parser came from the git project.

Quoted 2 lines

I think that this could be implemented extending the mem_options[] in file builtin-mem.c lines 205-221.

Or else, use 'perf record' directly as Andi suggested.

Quoted 3 lines
Quoted 3 lines

Alternatively you can just specify the command line perf mem record would specify directly to perf record, plus -c/-F

  $ perf record -Wd -e cpu/mem-loads/pp -F 200 -- ls
  $ perf mem report

Thanks,
Namhyung

#4 lore raw
Quoted 7 lines
Quoted 3 lines

I think that this could be implemented extending the mem_options[] in file builtin-mem.c lines 205-221.

Or else, use 'perf record' directly as Andi suggested.

Quoted 1 line
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

Alternatively you can just specify the command line perf mem record would specify directly to perf record, plus -c/-F

   $ perf record -Wd -e cpu/mem-loads/pp -F 200 -- ls
   $ perf mem report

Wow, thank you for such details! I'll take a look at this!

Best regards.

Quoted 3 lines

Thanks,
Namhyung

Signature · 11 lines
WARNING / LEGAL TEXT: This message is intended only for the use of the
individual or entity to which it is addressed and may contain
information which is privileged, confidential, proprietary, or exempt
from disclosure under applicable law. If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, you are strictly prohibited from disclosing,
distributing, copying, or in any way using this message. If you have
received this communication in error, please notify the sender and
destroy and delete any copies you may have received.

http://www.bsc.es/disclaimer