Revision 19d6b4ca measures.c

View differences:

measures.c
22 22
	int n_mhs;
23 23
} nodeID;
24 24

  
25
static MonHandler chunk_dup, chunk_playout, neigh_size, chunk_receive, chunk_send, offer_accept, chunk_hops, chunk_delay;
25
static MonHandler chunk_dup, chunk_playout, neigh_size, chunk_receive, chunk_send, offer_accept, chunk_hops, chunk_delay, playout_delay;
26 26
static MonHandler rx_bytes_chunk_per_sec, tx_bytes_chunk_per_sec, rx_bytes_sig_per_sec, tx_bytes_sig_per_sec;
27 27
static MonHandler rx_chunks, tx_chunks;
28 28

  
......
53 53
/*
54 54
 * Register playout/loss of a chunk before playout
55 55
*/
56
void reg_chunk_playout(bool b)
56
void reg_chunk_playout(int id, bool b, uint64_t timestamp)
57 57
{
58
	struct timeval tnow;
59

  
58 60
	if (!chunk_playout && b) {	//don't count losses before the first arrived chunk
59 61
		enum stat_types st[] = {AVG, SUM, RATE};
60 62
		add_measure(&chunk_playout, GENERIC, 0, 120, "ChunksPlayed", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[chunks]
61 63
	}
62 64
	monNewSample(chunk_playout, b);
65

  
66
	if (!playout_delay) {
67
		enum stat_types st[] = {WIN_AVG, WIN_VAR};
68
		add_measure(&playout_delay, GENERIC, 0, 120, "PlayoutDelay", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[peers]
69
	}
70
	gettimeofday(&tnow, NULL);
71
	monNewSample(playout_delay, tnow.tv_usec + tnow.tv_sec * 1000000ULL - timestamp);
63 72
}
64 73

  
65 74
/*

Also available in: Unified diff