Generic performance interface reqiurements - necto/denfer GitHub Wiki
This pages describes requirements to generic Linux/Windows performance interface (referred below as "interface") as a part of the whole project "profiler"
Functional requirements
General description
The developed interface should provide unified interface to various performance facilities available on host machine being used.
Analytical functions
The interface should detect available performance measuring facilities on local host machine. There should be a method to list them and if there are any restrictions on usage of them that should be mentioned.
Profiling functions
The interface should be able to attach to a running process specified by the profiler. If it is not possible due to host machine restrictions the interface should give an appropriate feedback to user. The interface should be able to use available performance facilities within allowed restrictions, gather and return required statistics about a running process.
Generic performance measurements
The interface should provide the following generic machine-independent methods to gather performance statistics:
- Function call counters
- ...
Interfaces specification
https://raw.github.com/necto/denfer/master/docs/images/Perf%20interface.png
Static common interface (Perf Counters Manager)
Static common interface should provide general profiling functionality independent from a particular session of application profiling. An example of such functionality is a listing of all available perf facilities on a host machine. Another function of static common interface is a managing of concurrent resources in case of many simultaneous sessions of profiling(see section "Perf counters" below). Note: 'static' here means not the way of implementation(it may vary), but the 'program-wide' nature of this interface.
Perf counters
Profiling itself is performed through creating performance counters and 'attaching' them to a measured process. Many performance counters may be attached to a single process and operate simultaneously, but only one process could be measured by a single counter. Moreover there should be a possibility to attach performance counters to many processes. Managing performance counters interactions with process and each other (explicitly or implicitly) is done with the static common interface.
Each of performance counters may have specific methods or define its own data structures to pass information back to profiler. But they all should have in common the following methods:
- Create&attach (constructor) - initialize a given perf counter and associate it with a running process.
- Detach&kill (destructor) - deassociate and clean up.
- Start/stop counting - initiate a single session of collecting performance data from a running process.
- Get counter values - obtain an internally collected data for external use. The data should be passed through an externally created data structure of a specific type.
- Reset - forget all collected data.
Function call counter
This performance counter should collect information about function calls within a specified time interval. The data is returned through a data structure of map type: Key "func_addr" - value "calls_num"
Non-functional requirements
Stability, code conventions and documentation requirements are inherited from global requirements for the project .