mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
perf_counter: add function to set a count
This needed the set function which sets elapsed to change the name to avoid ambiguities.
This commit is contained in:
@@ -299,7 +299,7 @@ perf_end(perf_counter_t handle)
|
||||
#include <systemlib/err.h>
|
||||
|
||||
void
|
||||
perf_set(perf_counter_t handle, int64_t elapsed)
|
||||
perf_set_elapsed(perf_counter_t handle, int64_t elapsed)
|
||||
{
|
||||
if (handle == NULL) {
|
||||
return;
|
||||
@@ -342,6 +342,25 @@ perf_set(perf_counter_t handle, int64_t elapsed)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
perf_set_count(perf_counter_t handle, uint64_t count)
|
||||
{
|
||||
if (handle == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (handle->type) {
|
||||
case PC_COUNT: {
|
||||
((struct perf_ctr_count *)handle)->event_count = count;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
perf_cancel(perf_counter_t handle)
|
||||
{
|
||||
|
||||
@@ -122,7 +122,17 @@ __EXPORT extern void perf_end(perf_counter_t handle);
|
||||
* @param handle The handle returned from perf_alloc.
|
||||
* @param elapsed The time elapsed. Negative values lead to incrementing the overrun counter.
|
||||
*/
|
||||
__EXPORT extern void perf_set(perf_counter_t handle, int64_t elapsed);
|
||||
__EXPORT extern void perf_set_elapsed(perf_counter_t handle, int64_t elapsed);
|
||||
|
||||
/**
|
||||
* Set a counter
|
||||
*
|
||||
* This call applies to counters of type PC_COUNT. It (re-)sets the count.
|
||||
*
|
||||
* @param handle The handle returned from perf_alloc.
|
||||
* @param count The counter value to be set.
|
||||
*/
|
||||
__EXPORT extern void perf_set_count(perf_counter_t handle, uint64_t count);
|
||||
|
||||
/**
|
||||
* Cancel a performance event.
|
||||
|
||||
Reference in New Issue
Block a user