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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
/**
* TimerStack a stack that holds methodtimes.
*/
#ifndef TIMERSTACK_H__
#define TIMERSTACK_H__
#include <jmp.h>
#include <method.h>
#include <methodtime.h>
typedef struct stack_node stack_node;
struct stack_node {
method* method;
long calls;
methodtime time_taken;
stack_node* parent;
stack_node* siebling;
stack_node* first_child;
};
struct timerstack {
methodtime* times;
stack_node* stack_node;
size_t top;
size_t max;
jlong last_contentation;
jlong cpu_time; /** Last result of get_thread_time. */
jlong contendtime; /** The time this thread has spend waiting for locks.. */
obj* waiting; /** The object this thread is waiting on. */
jlong timeout; /** wait timeout. */
JVMPI_RawMonitor monitor; /** The monitor for multi threaded access. */
};
/** Create a new stack with a minimun size of size.
* This stack will be expanded as needed.
*/
timerstack* timerstack_new (size_t size);
/** Delete the given stack. */
void timerstack_free (timerstack* s);
/** Expand the given stack. */
void timerstack_expand (timerstack* s);
/** Get the current value of need_locks. */
int timerstacks_get_need_locks ();
/** Set the need to lock flag. */
void timerstacks_set_need_locks (int i);
/** Lock a given timerstack */
void timerstack_lock (timerstack *s);
/** Unlock a given timerstack */
void timerstack_unlock (timerstack *s);
#endif /* TIMERSTACK_H__ */
/* Emacs Local Variables: */
/* Emacs mode:C */
/* Emacs c-indentation-style:"gnu" */
/* Emacs c-hanging-braces-alist:((brace-list-open)(brace-entry-open)(defun-open after)(substatement-open after)(block-close . c-snug-do-while)(extern-lang-open after)) */
/* Emacs c-cleanup-list:(brace-else-brace brace-elseif-brace space-before-funcall) */
/* Emacs c-basic-offset:4 */
/* Emacs End: */
|