LongPause.c 705 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
/* ---------------------------------------------------------------------------
 *
 * (c) The GHC Team, 2001-2005
 *
 * Catching long lock-acquisition pauses.
 *
 * --------------------------------------------------------------------------*/


#include "PosixSource.h"

#include "Rts.h"
#include "Trace.h"
#include "LongPause.h"

#if defined(THREADED_RTS)

void longPauseCb(uint64_t dur_ns STG_UNUSED, const char *desc STG_UNUSED) {
  trace(TRACE_gc, "LONG PAUSE(%s) %f", desc, 1.0 * dur_ns / 1e9);
}

void ACQUIRE_LOCK_CHECKED_(Mutex *mutex, int max_msec, const char *desc) {
  struct long_pause_ctx ctx;
  LONG_PAUSE_START(&ctx);
  ACQUIRE_LOCK(mutex);
  LONG_PAUSE_END(&ctx, max_msec, desc);
}

#endif