Permalink
Browse files

program execution USDTs

  • Loading branch information...
1 parent e4a236f commit 367909941a6f605155186a3f9dcbe753c2727a3a @postwait postwait committed Jul 21, 2012
Showing with 31 additions and 9 deletions.
  1. +12 −4 fq_dtrace.d
  2. +19 −5 fqd_routemgr.c
View
@@ -39,10 +39,14 @@ typedef struct {
} fq_remote_data_client_t;
provider fq {
- probe client__connect(fq_dtrace_remote_anon_client_t *, int);
- probe client__auth(fq_dtrace_remote_client_t *);
- probe client__auth__data(fq_dtrace_remote_data_client_t *);
- probe client__disconnect(fq_dtrace_remote_anon_client_t *, int);
+ probe client__connect(fq_dtrace_remote_anon_client_t *c, int m) :
+ (fq_remote_anon_client_t *c, int m);
+ probe client__disconnect(fq_dtrace_remote_anon_client_t *c, int m) :
+ (fq_remote_anon_client_t *c, int m);
+ probe client__auth(fq_dtrace_remote_client_t *c) :
+ (fq_remote_client_t *c);
+ probe client__auth__data(fq_dtrace_remote_data_client_t *c) :
+ (fq_remote_data_client_t *c);
probe queue__create__success(int, char *, int, char *, int, int);
probe queue__create__failure(int, char *, char *);
probe queue__destroy(int, char *);
@@ -63,4 +67,8 @@ provider fq {
(fq_remote_client_t *c,
fq_remote_data_client_t *d,
fq_msg_t *m);
+ probe route__program__entry(char *p, fq_dtrace_msg_t *m) :
+ (char *p, fq_msg_t *m);
+ probe route__program__return(char *p, fq_dtrace_msg_t *m, int32_t u) :
+ (char *p, fq_msg_t *m, int32_t u);
};
View
@@ -7,6 +7,7 @@
#include <ctype.h>
#include <dlfcn.h>
#include "fqd.h"
+#include "fq_dtrace.h"
uint32_t global_route_id = 1;
#define RR_SET_SIZE 32
@@ -84,11 +85,24 @@ walk_jump_table(struct prefix_jumptable *jt, fq_msg *m, int offset, struct queue
struct fqd_route_rule *r;
for(r=jt->rules;r;r=r->next) {
if(m->route.len >= r->prefix.len &&
- m->route.len <= r->match_maxlen &&
- apply_compiled_program(r->compiled_program, m)) {
- fq_rk *rk = (fq_rk *)r->queue;
- fq_debug(FQ_DEBUG_ROUTE, "M[%p] -> Q[%.*s]\n", (void *)m, rk->len, rk->name);
- add_queue_target(d, r->queue);
+ m->route.len <= r->match_maxlen) {
+ bool matched = false;
+ if(FQ_ROUTE_PROGRAM_ENTRY_ENABLED()) {
+ fq_dtrace_msg_t dmsg;
+ DTRACE_PACK_MSG(&dmsg, m);
+ FQ_ROUTE_PROGRAM_ENTRY(r->program, &dmsg);
+ }
+ if(apply_compiled_program(r->compiled_program, m)) {
+ fq_rk *rk = (fq_rk *)r->queue;
+ fq_debug(FQ_DEBUG_ROUTE, "M[%p] -> Q[%.*s]\n", (void *)m, rk->len, rk->name);
+ add_queue_target(d, r->queue);
+ matched = true;
+ }
+ if(FQ_ROUTE_PROGRAM_RETURN_ENABLED()) {
+ fq_dtrace_msg_t dmsg;
+ DTRACE_PACK_MSG(&dmsg, m);
+ FQ_ROUTE_PROGRAM_RETURN(r->program, &dmsg, matched);
+ }
}
}
}

0 comments on commit 3679099

Please sign in to comment.