-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmeasures.h
More file actions
77 lines (67 loc) · 2.29 KB
/
Copy pathmeasures.h
File metadata and controls
77 lines (67 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
* Copyright (c) 2010-2011 Csaba Kiraly
*
* This file is part of PeerStreamer.
*
* PeerStreamer is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* PeerStreamer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
* General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with PeerStreamer. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MEASURES_H
#define MEASURES_H
#include <stdbool.h>
#ifndef MONL
#include "list.h"
#include "malloc.h"
#endif
struct nodeID;
// alpha weight for the first-order mobile mean update
#define SAMPLE_WEIGHT 0.01
#ifndef MONL
#define MIN_RATE_VALUE 0.1
struct node_statistics {
struct list_head list;
struct nodeID * node;
double reception_rate; // ratio of expected msg arrived
double offer_accept_rtt;
};
void offer_accept_rtt_measure(const struct nodeID *id,const uint64_t oa_rtt);
void reception_measure(const struct nodeID *id);
void timeout_reception_measure(const struct nodeID *id);
void log_nodes_measures();
double get_reception_rate_measure(const struct nodeID *id);
#endif
void init_measures();
void end_measures();
void add_measures(const struct nodeID *id);
void delete_measures(const struct nodeID *id);
void reg_chunk_duplicate();
void reg_chunk_playout(int id, bool b, uint64_t timestamp);
void reg_neigh_size(int s);
void reg_chunk_receive(int id, uint64_t timestamp, int hopcount, bool old, bool dup);
void reg_chunk_send(int id);
void reg_offer_accept_out(bool b);
void reg_offer_accept_in(bool b);
void reg_offers_in_flight(int running_offer_threads);
void reg_queue_delay(double last_queue_delay);
void reg_period(double period);
double get_receive_delay(void);
#ifdef MONL
double get_rtt(struct nodeID *id);
double get_rtt_var(struct nodeID *id);
double get_lossrate(struct nodeID *id);
double get_transmitter_lossrate(struct nodeID *id);
double get_average_lossrate(struct nodeID**id, int len);
int get_hopcount(struct nodeID *id);
#endif
#endif