Resource:Performancebrowser
Introduction
Performance browser is used to monitor the performance of resources on the server. Specifically, it shows how much CPU time and memory each resource is consuming. It is useful for finding out which resources are slow, and which ones are leaking memory.
Web access
To allow access to the performance browser web interface, add an ACL which includes rights to 'resource.performancebrowser.http' and 'resource.ajax.http'. The server default ACL now comes with a "DevGroup" and "DevACL" specifically for this purpose. If your servers ACL does not have them, here is the acl.xml extract:
<group name="DevGroup"> <acl name="DevACL"/> </group> <acl name="DevACL"> <right name="resource.performancebrowser.http" access="true"></right> <right name="resource.ajax.http" access="true"></right> </acl>
Then all you have to do is add users to the "DevGroup" and use this URL in your browser: http://SERVER_IP:HTTP_PORT/performancebrowser/
In game access
There is also an in game version of performance browser called 'ipb' which is now part of the official server resources. If you don't have it, it can be found in the latest resources zip: http://code.google.com/p/mtasa-resources/downloads/list
Lua timings
Select Lua timings from the Category drop down to view timing information for each resource:
By default, there are three blocks of columns, each one representing a different sample period. In the picture below, block A represents samples taken in the last 5 seconds, block B represents samples taken in the last 60 seconds, and block C represents samples taken in the last 300 seconds.
The columns in each block are:
- name - Name of the resource
- cpu - Amount of CPU time taken (in percent)
- time - Amount of CPU time taken (in seconds)
- calls - The number of times the function was called
- avg - The average time spent in the function
- max - The maximum time spent in the function
Note: To keep the display as clear as possible, anything that has taken less than 0.01% of CPU time is not be displayed.
Options
Use the d option to display the timings for specific events and functions in the resource. If a function name cannot be determined, it will display the @ sign followed by the file name and line number the function starts. You can then locate that function by looking in the source file.
Use the 5, 60, 300 and 3600 options to select what sample periods to show. For example, the option string 5,60,300,3600 will show all 4 sample periods. (If no sample periods are chosen, the default of 5,60,300 is used.)
Use the Filter setting to view a smaller range of resources.
Lua memory
Select Lua memory from the Category drop down to view memory consumption of each Lua resource:
The columns are:
- name - Name of the resource
- change - The change in memory use since the last refresh
- current - The amount of memory the resource is using now
- max - The most memory the resource has ever used
- XMLFiles - The number of open XML files
- refs - The number of callback functions
- Timers - The number of active Timers
- Elements - The number of Elements
- TextDisplays - The number of Text Displays
- TextItems - The number of Text Items
Options
Use the a option to show more accurate memory usage. Note: This calls the Lua garbage collector before each refresh, which could slightly reduce server performance.
Use the Filter setting to view a smaller range of resources:
Lib memory
Select Lib memory from the Category drop down to view memory consumption of the appropriate library (.dll or .so)
Note: This information is only available if the library has been compiled with WITH_ALLOC_TRACKING set to 1
The columns are:
- name - Name of the library
- change - The change in memory use since the last refresh
- current - The amount of memory the library is using now
- max - The most memory the library has ever used
Options
Use the i option to show more information: