|
Define a trace buffer to use with the Pin trace buffer API. This function defines the shape of the buffer, but doesn't allocate the buffer itself. Each thread implicitly creates its first buffer on start-up. Additional buffers may then be created using PIN_AllocateBuffer, but this is only needed by tools using "double buffering".
- Parameters:
-
[in] | recordSize | Size (bytes) of each record in the buffer. This size must be less than the size of an OS page. |
[in] | numPages | The number of OS pages to allocate for each buffer. This size does not have to be an even multiple of recordSize. |
[in] | fun | A call-back function that is called whenever the buffer is full, or when the thread exits with a partially-full buffer. Note that when called for a full buffer, not during thread exit, this function is called WITHOUT holding any Pin locks. So that multiple threads may be executing the function simultaneously. It is the tool's responsibility to take care of the multi-thread safety of this function, and any functions called by it. |
[in] | val | Passed as the last argument to fun. |
- Returns:
- On success, a BUFFER_ID. On error (e.g., maximum number of trace buffers exceeded,) returns BUFFER_ID_INVALID.
- Note:
- This function obtains and releases the Pin Client Lock around any work it does
- Availability:
- Mode: JIT
O/S: Linux & Windows
CPU: IA-32 and Intel(R) 64 architectures
|