On Wed, Dec 16, 2020 at 10:54:43AM +0300, Alexei Budankov wrote: > > On 15.12.2020 22:43, Jiri Olsa wrote: > > On Tue, Dec 15, 2020 at 06:40:26PM +0300, Alexei Budankov wrote: > >> Hi, > >> > >> On 12.12.2020 13:43, Jiri Olsa wrote: > >>> Adding daemon command that allows to run record sessions > >>> on background. Each session represents one perf record > >>> process and is configured in config file. > >>> > >>> Example: > >>> > >>> # cat config.daemon > >>> [daemon] > >>> base=/opt/perfdata > >> > >> It could probably make sense to consider using locations at /var/ > >> directory, similar to other already existing daemon processes in > >> system so admin and user experience would be easily reusabe for > >> performance monitoring daemon (service). > > > > hm, you can specify any /var path in there if you like, > > do you suggest to hardcode it? > > This thing: https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard > Since Perf is a part of OS it would better use some standardized locations.
sure, user is free to configure that SNIP > >>> + start = current = time(NULL); > >>> + > >>> + do { > >>> + usleep(500); > >> > >> This polling design is actually sub-optimal because it induces redundant > >> noise in a system. Ideally it should be implemented in async fashion so > >> kernel would atomically notify daemon process on event happened in some > >> of record processes e.g. using of poll-like() system call. > > > > ok, any suggestion? > > Possibly, checking SIGCHLDs via signalfd [1] OR using pidfd [2] on kernel > v5.3+ > > [1] https://man7.org/linux/man-pages/man2/signalfd.2.html > [2] https://man7.org/linux/man-pages/man2/pidfd_open.2.html will check, thanks jirka