You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
613 B
27 lines
613 B
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "arch/getcycles.h"
|
|
#include "debuglog.h"
|
|
|
|
extern __thread uint64_t generic_thread_lock_duration;
|
|
extern __thread uint64_t generic_thread_start_timestamp;
|
|
|
|
/**
|
|
* Reports lock contention
|
|
*/
|
|
static inline void
|
|
generic_thread_dump_lock_overhead()
|
|
{
|
|
#ifndef NDEBUG
|
|
#ifdef LOG_LOCK_OVERHEAD
|
|
uint64_t duration = __getcycles() - generic_thread_start_timestamp;
|
|
debuglog("Locks consumed %lu / %lu cycles, or %f%%\n", generic_thread_lock_duration, duration,
|
|
(double)generic_thread_lock_duration / duration * 100);
|
|
#endif
|
|
#endif
|
|
}
|
|
|
|
void generic_thread_initialize();
|