Open milianw opened 7 years ago
More ideas:
some of this has been implemented now, but not enough to close this task
One thing to possibly do is output messages as perf report
does:
┌─Warning:─────────────────────────────────────────────────────────┐
│Kernel address maps (/proc/{kallsyms,modules}) were restricted. │
│ │
│Check /proc/sys/kernel/kptr_restrict before running 'perf record'.│
│ │
│As no suitable kallsyms nor vmlinux was found, kernel samples │
│can't be resolved. │
│ │
│Samples in kernel modules can't be resolved as well. │
│ │
│ │
│ │
│Press any key... │
└──────────────────────────────────────────────────────────────────┘
┌─Error:───────────────────────────┐
│The perf.data file has no samples!│
│ │
│ │
│Press any key... │
└──────────────────────────────────┘
In this case there's currently an endless "Loading Results..." bar in hotspot-v1.3.0-x86_64-NoRustDemanglingForCentOS7.AppImage
thanks, could you please upload such an empty perf.data
file so I can test and reproduce it locally?
The likely easiest way to get it is echo 1 | sudo tee /proc/sys/kernel/kptr_restrict
, then running perf :-)
That still allows user samples, so my perf.data
is not empty:
$ echo 1 | sudo tee /proc/sys/kernel/kptr_restrict
1
$ perf record ls
...
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.002 MB perf.data (9 samples) ]
how did you get the empty perf.data
file? can you send it to me please?
I was able to create an empty one using:
$> echo "int main() {return 0;}" | gcc -x c -
$> perf record ./out
(note: the original program where this happened was a "real" one, but I can't remember how this happens)
File attached: perf.zip. Using this with hotspot-perfparser leads to:
FINISHED_ROUND detected. Switching to automatic buffering
QPERFSTREAM
I think this once chrashed hotspot, but that's fine now and I don't think we need a special message there.
And just because: I've tested a broken perf recording:
$> perf record none
Failed to collect 'cpu-clock:uhpppH' for the 'none' workload: No such file or directory
$> hotspot-perfparser --input perf.data
Feature announced in header but not present: PerfHeader::HOSTNAME
Feature announced in header but not present: PerfHeader::CPUDESC
Feature announced in header but not present: PerfHeader::CPUID
Feature announced in header but not present: PerfHeader::TOTAL_MEM
Feature announced in header but not present: PerfHeader::CMDLINE
Feature announced in header but not present: PerfHeader::EVENT_DESC
Feature announced in header but not present: PerfHeader::CPU_TOPOLOGY
Feature announced in header but not present: PerfHeader::NUMA_TOPOLOGY
Feature announced in header but not present: PerfHeader::PMU_MAPPINGS
Feature announced in header but not present: PerfHeader::CACHE
Feature announced in header but not present: PerfHeader::SAMPLE_TIME
Feature announced in header but not present: PerfHeader::MEM_TOPOLOGY
Feature announced in header but not present: PerfHeader::BPF_PROG_INFO
Feature announced in header but not present: PerfHeader::BPF_BTF
Feature announced in header but not present: PerfHeader::CPU_PMU_CAPS
feature not properly read PerfHeader::ARCH 13510798882111491 424
feature not properly read PerfHeader::NRCPUS 7311705240702707056 0
feature not properly read PerfHeader::OSRELEASE 9007199254741066 424
feature not properly read PerfHeader::VERSION 16711680 0
^C
hotspot loops with the file that perf "records" that way, so this should be fixed.
parsing perf.data can often produce misleading results when anything is amiss. We need to tell the user about such situations by extending upstream error reporting: