Failed to use "Intel PT(Processor Trace)" with perf in Ubuntu VM

Discussions about using Linux guests in VirtualBox.
Post Reply
hapytrefrend
Posts: 2
Joined: 15. Dec 2016, 09:01

Failed to use "Intel PT(Processor Trace)" with perf in Ubuntu VM

Post by hapytrefrend »

Failed to use "Intel PT(Processor Trace)" with perf in Ubuntu VM


Hello guys,

I have been trying to use "Intel PT(Processor Trace)" on Ubuntu running on Virtualbox as I did not want to mess up the server itself.
PT runs fine on the host (server) and creates perf.data as supposed to.
The command I used is

Code: Select all

perf record -e intel_pt//u ls 

Howerver, when trying on virtualbox, it was not successful.
The error message appears as below.

Code: Select all

user@user-vb:~$ perf record -e intel_pt//u ls
invalid or unsupported event: 'intel_pt//u'
Run 'perf list' for a list of valid events

Usage: perf record [<options>] [<command>] or: perf record [<options>] -- <command> [<options>]
-e, --event <event>   event selector. use 'perf list' to list available events

Has anyone been able to initialise "Intel PT" in Ubuntu running on VirtualBox?
Is there anyway to utilise this function or am I doing something wrong?
Any comments or ideas are welcome !!


Thank you so much in advance
Have a great Christmas

-hapytrefrend
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Failed to use "Intel PT(Processor Trace)" with perf in Ubuntu VM

Post by socratis »

I'm not sure but I have the feeling that the command line option is not correct and the program tells you about it:
invalid or unsupported event: 'intel_pt//u'
Run 'perf list' for a list of valid events
Did you follow that advice? What is the list of valid events?

BTW, are you trying to measure performance counters on a VM? Not a great idea, It's going to be widely inaccurate.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
hapytrefrend
Posts: 2
Joined: 15. Dec 2016, 09:01

Re: Failed to use "Intel PT(Processor Trace)" with perf in Ubuntu VM

Post by hapytrefrend »

Yes we did,
The valid list is as below.

Code: Select all

perf list
List of pre-defined events (to be used in -e):

  alignment-faults                                   [Software event]
  bpf-output                                         [Software event]
  context-switches OR cs                             [Software event]
  cpu-clock                                          [Software event]
  cpu-migrations OR migrations                       [Software event]
  dummy                                              [Software event]
  emulation-faults                                   [Software event]
  major-faults                                       [Software event]
  minor-faults                                       [Software event]
  page-faults OR faults                              [Software event]
  task-clock                                         [Software event]

  msr/smi/                                           [Kernel PMU event]
  msr/tsc/                                           [Kernel PMU event]

  rNNN                                               [Raw hardware event descriptor]
  cpu/t1=v1[,t2=v2,t3 ...]/modifier                  [Raw hardware event descriptor]
   (see 'man perf-list' on how to encode it)

  mem:<addr>[/len][:access]                          [Hardware breakpoint]
As you can see, there is not "Kernel PMU event - intel_pt//" which can be found on the server as below.

Code: Select all

intel_bts//                                        [Kernel PMU event]
intel_pt//                                         [Kernel PMU event]
And to answer your second question,
I am trying to use "intel_pt//" so that when recording traces, I will be able to record more than just "system calls".
(my understanding is that if you only use "pref" to trace, it will be recording just "system calls")

Thank you !
Last edited by socratis on 15. Dec 2016, 11:06, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Failed to use "Intel PT(Processor Trace)" with perf in Ubuntu VM

Post by socratis »

  1. Are the two 'perf' versions the same?
  2. Why do you expect an option in one to exist in the other?
  3. I just installed 'perf version 3.13.9' on an Ubuntu VM and I get a different output from yours:

    Code: Select all

    socratis@VB-Mint ~ $ perf list
    
    List of pre-defined events (to be used in -e):
      cpu-clock                                          [Software event]
      task-clock                                         [Software event]
      page-faults OR faults                              [Software event]
      context-switches OR cs                             [Software event]
      cpu-migrations OR migrations                       [Software event]
      minor-faults                                       [Software event]
      major-faults                                       [Software event]
      alignment-faults                                   [Software event]
      emulation-faults                                   [Software event]
      dummy                                              [Software event]
    
      uncore_cbox_0/clockticks/                          [Kernel PMU event]
      uncore_cbox_1/clockticks/                          [Kernel PMU event]
    
      rNNN                                               [Raw hardware event descriptor]
      cpu/t1=v1[,t2=v2,t3 ...]/modifier                  [Raw hardware event descriptor]
       (see 'man perf-list' on how to encode it)
    
      mem:<addr>[:access]                                [Hardware breakpoint]
    
    For example I don't have the "bfr-output" and our "Kernel PMU event" category is different.
  4. Unless the 'perf' command adapts to what's available on the VM. For example, in a VM, there is no VT-x. In that case there's nothing you can do.
  5. I still don't see why this is a VirtualBox issue, unless it has to do with the previous point.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply