Commit bb3b35f9 authored by Tommy Olofsson's avatar Tommy Olofsson
Browse files

Added more tracing to vx event queue. Some event hangs the event task.

parent 3376fc84
......@@ -443,6 +443,7 @@ void handle_data_sample(firefly_protocol_data_sample *data, void *context)
unsigned char *fers_data;
int ret;
printf("%s", __func__);
conn = context;
fers = FIREFLY_RUNTIME_MALLOC(conn, sizeof(*fers));
fers_data = FIREFLY_RUNTIME_MALLOC(conn, data->app_enc_data.n_0);
......
......@@ -394,6 +394,7 @@ static int firefly_transport_udp_posix_read_event(void *event_arg)
struct transport_llp_udp_posix *llp_udp;
struct firefly_connection *conn;
printf("exec read ev\n");
ev_arg = event_arg;
llp_udp = ev_arg->llp->llp_platspec;
......@@ -476,7 +477,7 @@ void firefly_transport_udp_posix_read(struct firefly_transport_llp *llp)
/* printf("recv %d byte\n", pkg_len); */
res = recvfrom(llp_udp->local_udp_socket, (void *) ev_arg->data, pkg_len, 0,
(struct sockaddr *) &remote_addr, (void *) &len);
/* printf("recv'd %d byte\n", res); */
printf("recv'd %d byte\n", res);
if (res == -1) {
char err_buf[ERROR_STR_MAX_LEN];
#ifdef LABCOMM_COMPAT
......@@ -496,6 +497,7 @@ void firefly_transport_udp_posix_read(struct firefly_transport_llp *llp)
FIREFLY_PRIORITY_HIGH,
firefly_transport_udp_posix_read_event,
ev_arg, 0, NULL);
printf("put read ev\n");
}
bool sockaddr_in_eq(struct sockaddr_in *one, struct sockaddr_in *other)
......
......@@ -95,8 +95,12 @@ int64_t firefly_event_queue_vx_add(struct firefly_event_queue *eq,
semTake(ctx->lock, WAIT_FOREVER);
res = firefly_event_add(eq, prio, execute, context, nbr_deps, deps);
semGive(ctx->lock);
if (res > 0)
if (res > 0) {
printf("ADDING ev\n");
semGive(ctx->signal);
printf("ADDED ev\n");
} else
printf("FAILED TO ADD EVENT\n");
return res;
}
......@@ -121,33 +125,38 @@ void *firefly_event_vx_thread_main(void *args)
semTake(ctx->lock, WAIT_FOREVER);
event_left = firefly_event_queue_length(eq);
finish = ctx->event_loop_stop;
printf("EQ LEN: %d, DONE: %d\n", event_left, finish);
while (event_left <= 0 && !finish) {
semGive(ctx->lock);
printf("WAIT SIG\n");
semTake(ctx->signal, WAIT_FOREVER);
printf("GOT SIG\n");
semTake(ctx->lock, WAIT_FOREVER);
finish = ctx->event_loop_stop;
event_left = firefly_event_queue_length(eq);
}
ev = firefly_event_pop(eq);
semGive(ctx->lock);
printf("got ev?\n");
printf("GOT EV?\n");
if (ev) {
/* TODO: Retval can indicate badly contructed event, or
* failed execution. Should this be handled?
*/
printf("executing ev. %p\n", ev->execute);
printf("EXECUTING EV. %p\n", ev->execute);
firefly_event_execute(ev);
printf("executing ev done.\n");
printf("EXECUTING EV DONE.\n");
semTake(ctx->lock, WAIT_FOREVER);
firefly_event_return(eq, &ev);
semGive(ctx->lock);
printf("event returned\n");
}
printf("(EVENT RETURNED)\n");
} else
printf("NO EVENT\n");
}
/* semTake(ctx->lock, WAIT_FOREVER); */
semGive(ctx->dead);
/* semGive(ctx->lock); */
printf("EVENT THREAD TERMINATING\n");
return NULL;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment