appctx->chunk = NULL;
appctx->io_release = NULL;
appctx->thread_mask = thread_mask;
+ appctx->call_rate.curr_sec = 0;
+ appctx->call_rate.curr_ctr = 0;
+ appctx->call_rate.prev_ctr = 0;
appctx->state = 0;
}
#ifndef _TYPES_APPLET_H
#define _TYPES_APPLET_H
+#include <types/freq_ctr.h>
#include <types/hlua.h>
#include <types/obj_type.h>
#include <types/proxy.h>
struct buffer_wait buffer_wait; /* position in the list of objects waiting for a buffer */
unsigned long thread_mask; /* mask of thread IDs authorized to process the applet */
struct task *t; /* task associated to the applet */
+ struct freq_ctr call_rate; /* appctx call rate */
union {
struct {
si_cant_get(si);
si_rx_endp_done(si);
+ /* measure the call rate */
+ update_freq_ctr(&app->call_rate, 1);
+
/* Now we'll try to allocate the input buffer. We wake up the applet in
* all cases. So this is the applet's responsibility to check if this
* buffer was allocated or not. This leaves a chance for applets to do
}
else if ((tmpctx = objt_appctx(strm->si[0].end)) != NULL) {
chunk_appendf(&trash,
- " app0=%p st0=%d st1=%d st2=%d applet=%s tmask=0x%lx nice=%d calls=%u cpu=%llu lat=%llu\n",
+ " app0=%p st0=%d st1=%d st2=%d applet=%s tmask=0x%lx nice=%d calls=%u rate=%u cpu=%llu lat=%llu\n",
tmpctx,
tmpctx->st0,
tmpctx->st1,
tmpctx->st2,
tmpctx->applet->name,
tmpctx->thread_mask,
- tmpctx->t->nice, tmpctx->t->calls,
+ tmpctx->t->nice, tmpctx->t->calls, read_freq_ctr(&tmpctx->call_rate),
(unsigned long long)tmpctx->t->cpu_time, (unsigned long long)tmpctx->t->lat_time);
}
}
else if ((tmpctx = objt_appctx(strm->si[1].end)) != NULL) {
chunk_appendf(&trash,
- " app1=%p st0=%d st1=%d st2=%d applet=%s tmask=0x%lx, nice=%d, calls=%u, cpu=%llu, lat=%llu\n",
+ " app1=%p st0=%d st1=%d st2=%d applet=%s tmask=0x%lx nice=%d calls=%u rate=%u cpu=%llu lat=%llu\n",
tmpctx,
tmpctx->st0,
tmpctx->st1,
tmpctx->st2,
tmpctx->applet->name,
tmpctx->thread_mask,
- tmpctx->t->nice, tmpctx->t->calls,
+ tmpctx->t->nice, tmpctx->t->calls, read_freq_ctr(&tmpctx->call_rate),
(unsigned long long)tmpctx->t->cpu_time, (unsigned long long)tmpctx->t->lat_time);
}