Valgrind plugin for dynamic detection and analysis of program event loops