I have a flight recorder style command that address this problem
(long-running/daemons) by processing task events and then stashing
the sample events on a time-ordered list with chopping to maintain
the time window.
so far I noticed there could be race among EXIT and remaining
SAMPLE events on another CPU mmap than EXIT event.. ending up
with EXIT being stored in the old file, while SAMPLEs will get
to the new one
I was thinking about some 'perf daemon' so I dont need to run that
manually.. seems similar to what you did
Right now I focus on scheduling events. This latest version of it can be
easily recycled for other use cases. Some work would be needed to dump
events to a file versus dumping processed information.
I am in San Jose this week. Not sure if I will have time to finish it to
a point of pushing out patches, but maybe I can push to github in the
next couple of days.