File: statistics_user.cpp

package info (click to toggle)
entropybroker 2.9-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,600 kB
  • sloc: cpp: 14,386; sh: 934; makefile: 188; java: 148; perl: 12
file content (35 lines) | stat: -rw-r--r-- 547 bytes parent folder | download | duplicates (3)
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
#include <stdio.h>
#include <pthread.h>
#include <string>
#include <math.h>
#include <vector>

#include "error.h"
#include "log.h"
#include "utils.h"
#include "statistics.h"
#include "statistics_user.h"

statistics_user::statistics_user()
{
	connected_since = 0;
}

void statistics_user::register_msg(bool is_put)
{
	double now = get_ts();

	my_mutex_lock(&time_lck);

	if (connected_since == 0)
		connected_since = now;

	last_message = now;

	if (is_put)
		last_put_message = now;
	else
		last_get_message = now;

	my_mutex_unlock(&time_lck);
}