]>
Commit | Line | Data |
---|---|---|
1 | # A basic Plugin that creates performance reports from zprint output | |
2 | kern_version = None | |
3 | ||
4 | def plugin_init(kernel_target, config, lldb_obj, isConnected): | |
5 | """ initialize the common data as required by plugin """ | |
6 | global kern_version | |
7 | kern_version = str(kernel_target.version) | |
8 | ||
9 | def plugin_execute(command_name, result_output): | |
10 | """ The xnu framework will call this function with output of a command. | |
11 | The options for returning are as follows | |
12 | returns: (status, outstr, further_cmds) | |
13 | status: Boolean - specifying whether plugin execution succeeded(True) or failed. If failed then xnu will stop doing any further work with this command. | |
14 | outstr: str - string output for user to be printed at the prompt | |
15 | further_cmds: [] of str - this holds set of commands to execute at the lldb prompt. Empty array if nothing is required. | |
16 | """ | |
17 | status = True | |
18 | outstr = 'Nothing to be done here' | |
19 | further_cmds = [] | |
20 | further_cmds.append("memstats -- --plugin zprint_perf_log ") | |
21 | ||
22 | if command_name != 'zprint' : | |
23 | status = False | |
24 | else: | |
25 | num_zones = len(result_output.split("\n")) -1 | |
26 | outstr += "Num of zones analyzed =" + str(num_zones) + "\n" | |
27 | return (status, outstr, further_cmds) | |
28 | ||
29 | def plugin_cleanup(): | |
30 | """ A cleanup call from xnu which is a signal to wrap up any open file descriptors etc. """ | |
31 | return None |