Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perfcollect issue while executing perf script (kubernetes engine) #10509

Closed
sterchelen opened this issue Jun 13, 2018 · 9 comments
Closed

Perfcollect issue while executing perf script (kubernetes engine) #10509

sterchelen opened this issue Jun 13, 2018 · 9 comments

Comments

@sterchelen
Copy link

Hi,

First of all my workload is on Kubernetes engine. We run our pods on container optimized os from google. With this OS it's almost impossible to collect tracing events. So I created a node with ubuntu.
I can run perfcollect with no problem until the execution of the perf script statement which tries to output with cpu field. An error is thrown with the following description :
'cpu-clock' event do not have CPU attribute set.

  • I run perfcollect as follow: ./perfcollect collect test -pid myPID

Does anyone has faced this issue ?

Thank you.

@jkotas
Copy link
Member

jkotas commented Jun 13, 2018

cc @brianrob

@brianrob
Copy link
Member

I have seen this once before, but it's not clear to me why it happens. It basically means that the CPU number is not available as part of the cpu-clock events.

If you want to work around this you can remove the cpu item from the calls to 'perf script' here: https://github.com/dotnet/corefx-tools/blob/master/src/performance/perfcollect/perfcollect#L1523.

I have filed an issue to see what can be done here: dotnet/corefx-tools#84

@tommcdon
Copy link
Member

cc @sywhang

@sywhang
Copy link
Contributor

sywhang commented Mar 4, 2019

This is showing up in more and more places, for example - dotnet/corefx-tools#92. This causes users to be unable to read their traces from PerfView because that error leads to perf.data.txt file not being populated in the trace zip file. I'll spend some time later this week to investigate why this might be happening.

@paraspatidar
Copy link

paraspatidar commented Mar 5, 2019

FYI , apart from kubernetes , same behavior is observed on Ubuntu VM on azure.
However on Ubuntu it happens only when we pass -pid in perfcollect as argument to specifically target perticular dotnet process.

for normal run where it collect for all CPUs (-a) , then it is successfully able to get CPU traces.
(however on kubernetes we have no other option but to use -pid as -a failed due to access issue)

when running that command manually :
/usr/bin/perf script -i perf.data.merged -f comm,pid,tid,cpu,time,event,ip,sym,dso,trace > perf.data.txt :
output : Samples for 'cpu-clock' event do not have CPU attribute set

OS :
NAME="Ubuntu"
VERSION="18.04.1 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.1 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

uname -r : 4.18.0-1011-azure

@sywhang
Copy link
Contributor

sywhang commented Apr 4, 2019

I opened dotnet/corefx-tools#100 to track this instead of this issue, since it isn't really a runtime issue but more of the perfcollect script (corefx-tools is where that tool lives).

@sywhang sywhang closed this as completed Apr 4, 2019
@sterchelen
Copy link
Author

sterchelen commented Apr 5, 2019 via email

@sywhang
Copy link
Contributor

sywhang commented Apr 5, 2019

On Windows, there is already various ways that you can get do performance analysis such as ETW and PerfView.

To make this available on all platforms that we support on .NET Core, we are actively working on various runtime support such as EventPipe, runtime performance counters, etc. This project board (https://github.com/dotnet/coreclr/projects/5) tracks the work items that we are actively working on.

If you have specific questions about your scenario, feel free to reach out via issues on GitHub, or to my email (listed on my profile).

@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@msftgits msftgits added this to the 3.0 milestone Jan 31, 2020
@lathiat
Copy link

lathiat commented May 17, 2020

I found this issue on Google when researching a similar error but in a different software suite.. sharing a few notes here in case someone comes back to this ticket:

I believe the reason this happens is that if you are on metal with hardware performance counters, perf uses the 'cycles' event that has the CPU number. If you are on a VM without hardware performance counters (which is most of the time, particularly in public clouds due to security reasons, I think some AWS instance types where you have dedicated hardware access might give you some performance counters even in a VM), then it uses the software 'cpu-clock' event which does not have this field.

I didn't get to figuring out why in some configurations using all-CPU versus per-process mode seems to result in the CPU field appearing or disappearing.

When using "perf script"'s "-F" field specifier you can specify different fields for "software", "hardware" and "trace" events. Unfortunately if you specify a format for hardware events and there are no such in the file then it errors out. So it seems we can't ask "perf script" to handle this for us and likely some kind of software detection is going to be required.

Hope it helps someone...

@ghost ghost locked as resolved and limited conversation to collaborators Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants