@@ -0,0 +1,1115 @@
+# -*- coding: utf-8 -*-%0A#------------------------------------------------------------------------------%0A#  Package: Pikos toolkit%0A#  File: benchmark/monitors.py%0A#  License: LICENSE.TXT%0A#%0A#  Copyright (c) 2012, Enthought, Inc.%0A#  All rights reserved.%0A#------------------------------------------------------------------------------%0A%22%22%22 Profile the python profile functions.%0A%0AThe benchmark runs the various pure python %60set profile%60 methods by%0Asimulating the fake calls.%0A%0A%22%22%22%0Aimport cProfile%0Aimport inspect%0A%0Afrom pikos.monitors.function_monitor import FunctionMonitor%0Afrom pikos.benchmark.record_counter import RecordCounter%0A%0A%0Adef function_profile_monitor(monitor_factory, filename):%0A    recorder = RecordCounter()%0A    monitor = monitor_factory(recorder=recorder)%0A    profiler = cProfile.Profile()%0A    frame = inspect.currentframe()%0A    profiler.enable()%0A    for i in range(10000):%0A        monitor.on_function_event(frame, 'call', None)%0A    profiler.disable()%0A    profiler.dump_stats(filename)%0A%0A%0Adef main():%0A    function_profile_monitor(FunctionMonitor, 'function_monitor_call')%0A%0Aif __name__ == '__main__':%0A    main()%0A

add a benchmark script to improve the performance of the base function monitor