}
#ifdef WITH_PERF
-void unlang_frame_perf_init(unlang_t const *instruction)
+void unlang_frame_perf_init(unlang_stack_frame_t *frame)
{
unlang_thread_t *t;
fr_time_t now;
+ unlang_t const *instruction = frame->instruction;
if (!instruction->number || !unlang_thread_array) return;
t->use_count++;
now = fr_time();
- fr_time_tracking_start(NULL, &t->tracking, now);
- fr_time_tracking_yield(&t->tracking, now);
+ fr_time_tracking_start(NULL, &frame->tracking, now);
+ fr_time_tracking_yield(&frame->tracking, now);
}
-void unlang_frame_perf_yield(unlang_t const *instruction)
+void unlang_frame_perf_yield(unlang_stack_frame_t *frame)
{
- unlang_thread_t *t;
+ unlang_t const *instruction = frame->instruction;
if (!instruction->number || !unlang_thread_array) return;
- fr_assert(instruction->number <= unlang_number);
-
- t = &unlang_thread_array[instruction->number];
-
- fr_time_tracking_yield(&t->tracking, fr_time());
+ fr_time_tracking_yield(&frame->tracking, fr_time());
}
-void unlang_frame_perf_resume(unlang_t const *instruction)
+void unlang_frame_perf_resume(unlang_stack_frame_t *frame)
{
- unlang_thread_t *t;
+ unlang_t const *instruction = frame->instruction;
if (!instruction->number || !unlang_thread_array) return;
- fr_assert(instruction->number <= unlang_number);
-
- t = &unlang_thread_array[instruction->number];
-
- fr_time_tracking_resume(&t->tracking, fr_time());
+ fr_time_tracking_resume(&frame->tracking, fr_time());
}
-void unlang_frame_perf_cleanup(unlang_t const *instruction)
+void unlang_frame_perf_cleanup(unlang_stack_frame_t *frame)
{
unlang_thread_t *t;
+ unlang_t const *instruction = frame->instruction;
if (!instruction || !instruction->number || !unlang_thread_array) return;
t = &unlang_thread_array[instruction->number];
- fr_time_tracking_end(NULL, &t->tracking, fr_time());
+ fr_time_tracking_end(NULL, &frame->tracking, fr_time());
+ t->tracking.running_total = fr_time_delta_add(t->tracking.running_total, frame->tracking.running_total);
+ t->tracking.waiting_total = fr_time_delta_add(t->tracking.waiting_total, frame->tracking.waiting_total);
}
RDEBUG4("** [%i] %s >> %s", stack->depth, __FUNCTION__,
unlang_ops[instruction->type].name);
- unlang_frame_perf_resume(instruction);
+ unlang_frame_perf_resume(frame);
fr_assert(frame->process != NULL);
/*
* should be evaluated again.
*/
repeatable_clear(frame);
- unlang_frame_perf_resume(frame->instruction);
+ unlang_frame_perf_resume(frame);
ua = frame->process(result, request, frame);
/*
* now continue at the deepest frame.
*/
case UNLANG_ACTION_PUSHED_CHILD:
+ unlang_frame_perf_yield(frame);
fr_assert(&stack->frame[stack->depth] > frame);
*result = frame->result;
return UNLANG_FRAME_ACTION_NEXT;
* called the interpreter.
*/
case UNLANG_ACTION_YIELD:
- unlang_frame_perf_yield(instruction);
+ unlang_frame_perf_yield(frame);
yielded_set(frame);
RDEBUG4("** [%i] %s - yielding with current (%s %d)", stack->depth, __FUNCTION__,
fr_table_str_by_value(mod_rcode_table, frame->result, "<invalid>"),
} unlang_thread_t;
#ifdef WITH_PERF
-void unlang_frame_perf_init(unlang_t const *instruction);
-void unlang_frame_perf_yield(unlang_t const *instruction);
-void unlang_frame_perf_resume(unlang_t const *instruction);
-void unlang_frame_perf_cleanup(unlang_t const *instruction);
+void unlang_frame_perf_init(unlang_stack_frame_t *frame);
+void unlang_frame_perf_yield(unlang_stack_frame_t *frame);
+void unlang_frame_perf_resume(unlang_stack_frame_t *frame);
+void unlang_frame_perf_cleanup(unlang_stack_frame_t *frame);
#else
#define unlang_frame_perf_init(_x)
+#define unlang_frame_perf_yield(_x)
#define unlang_frame_perf_resume(_x)
#define unlang_frame_perf_cleanup(_x)
#endif
///< this priority will be compared with the one of the
///< frame lower in the stack to determine if the
///< result stored in the lower stack frame should
- ///< be replaced.
uint8_t uflags; //!< Unwind markers
+#ifdef WITH_PERF
+ fr_time_tracking_t tracking; //!< track this instance of this instruction
+#endif
};
/** An unlang stack associated with a request
unlang_op_t *op;
char const *name;
- unlang_frame_perf_init(instruction);
+ unlang_frame_perf_init(frame);
op = &unlang_ops[instruction->type];
name = op->frame_state_type ? op->frame_state_type : __location__;
TALLOC_FREE(frame->state);
}
- unlang_frame_perf_cleanup(frame->instruction);
+ unlang_frame_perf_cleanup(frame);
}
/** Advance to the next sibling instruction