1

I was wondering if there's a way to "schedule" HPROF dumps so that we can have an HPROF file generated per day (or per hour depending on the size).

What I am thinking was to add profiling on the production system and have it as part of their daily reports so it becomes "routine" rather than a sudden hit because it is part of our regular process. Sort of the idea here https://youtu.be/hnpzNAPiC0E?t=1259

Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265

1 Answers1

0

If you know the PID, you can call jmap periodically from a cron script:

jmap -dump:live,format=b,file=app.hprof <pid>

The PID could come from a PID file if available or from the output of systemctl status <service name> if systemd is used.

Ingo Kegel
  • 46,523
  • 10
  • 71
  • 102