Skip to content
Snippets Groups Projects
Commit f7d6e269 authored by Nadav Har'El's avatar Nadav Har'El
Browse files

Condvar: Add some tracepoints

parent ac76d75a
No related branches found
No related tags found
No related merge requests found
#include <osv/condvar.h>
#include <sched.h>
#include <errno.h>
#include <osv/trace.hh>
#include <osv/wait_record.hh>
TRACEPOINT(trace_condvar_wait, "%p", condvar *);
TRACEPOINT(trace_condvar_wake_one, "%p", condvar *);
TRACEPOINT(trace_condvar_wake_all, "%p", condvar *);
int condvar_wait(condvar_t *condvar, mutex_t* user_mutex, uint64_t expiration)
{
if (expiration) {
......@@ -16,6 +21,7 @@ int condvar_wait(condvar_t *condvar, mutex_t* user_mutex, uint64_t expiration)
int condvar_wait(condvar_t *condvar, mutex_t* user_mutex, sched::timer* tmr)
{
trace_condvar_wait(condvar);
int ret = 0;
wait_record wr(sched::thread::current());
......@@ -74,6 +80,7 @@ int condvar_wait(condvar_t *condvar, mutex_t* user_mutex, sched::timer* tmr)
void condvar_wake_one(condvar_t *condvar)
{
trace_condvar_wake_one(condvar);
// To make wake with no waiters faster, and avoid unnecessary contention
// in that case, first check the queue head outside the lock. If it is not
// empty, we still need to take the lock, and re-read the head.
......@@ -103,6 +110,7 @@ void condvar_wake_one(condvar_t *condvar)
void condvar_wake_all(condvar_t *condvar)
{
trace_condvar_wake_all(condvar);
if (!condvar->waiters_fifo.oldest) {
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment