Good day Thierry,
On 29 June 2017 at 03:09, Thierry Laviron Thierry.Laviron@arm.com wrote:
Hi Mathieu,
I am currently trying to get trace data using the CoreSight system in SysFS mode on my Juno r2 board.
I found some documentation on how to use it in the Documentation/trace/coresight.txt file of the perf-opencsd-4.11 branch of the OpenCSD repository.
This document says that I can retrieve the trace data from /dev/ using dd, for example in my case that would be
root@juno-debian:~# dd if=/dev/20070000.etr of=~/cstrace.bin
However, I am assuming this produces a dump of the memory buffer as it was when I stopped trace collection,
That is correct.
And that I do not have the full trace data generated (because it does not fit on the buffer).
Also correct. If there was a buffer overflow then you'll only get the latest trace data.
I would like to be able to capture a continuous stream of data from the ETR, but did not find how should I do that.
Currently the only way to do that is to use coresight from the perf interface (see HOWTO.md on github).
I am writing a C program. Can I open a read access to the ETR buffer like this?
open(“/dev/20070000.etr”, O_RDONLY);
So simply have a read() or a select() blocking on the file descriptor, waiting for trace data to be produced and consuming it as it is generated?
and then read its content, or pipe it somewhere else (e.g. to a file on the disc)?
Unfortunately no.
If there is more relevant documentation on this that I have not found, I would appreciate if you could point me to it.
If not, and what I am trying to do will not work, I would welcome some advice on how to do it properly.
You are raising an interesting scenario that hasn't occurred before. When operating from sysFS the problem is to program the tracers to reduce the amount of traces generated. Otherwise userspace can't possibly cope and you'd end up with buffer overflows. But let's assume you got that part covered there is still a problem of when to move trace data from the ETR buffer (contiguous or SG list) to the buffer conveyed by read/select(). That is a tedious problem that currently doesn't have a solution.
As I said earlier this is a compelling use case. As such I am coping the coresight mailing list along with Mike and Suzuki. Someone might have some interest in working on this or some thoughts on how to address the issue. It's even better if you want to offer a solution - we'll be happy to provide help and support.
Thanks, Mathieu
Thanks in advance.
Best regards,
Thierry Laviron
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.