summaryrefslogtreecommitdiff
path: root/poppler/ProfileData.cc
blob: a0c44747a56c3c19e597009a3b1fa2c9c58c542a (plain)
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
//========================================================================
//
// ProfileData.cc
//
// Copyright 2005 Jonathan Blandford <jrb@gnome.org>
//
//========================================================================

#include <config.h>

#ifdef USE_GCC_PRAGMAS
#pragma implementation
#endif

#include <stdlib.h>
#include <stddef.h>
#include "ProfileData.h"

//------------------------------------------------------------------------
// ProfileData
//------------------------------------------------------------------------

ProfileData::ProfileData() {
	count = 0;
	total = 0.0;
	min = 0.0;
	max = 0.0;
}

void
ProfileData::addElement (double elapsed) {
	if (count == 0) {
		min = elapsed;
		max = elapsed;
	} else {
		if (elapsed < min)
			min = elapsed;
		if (elapsed > max)
			max = elapsed;
	}
	total += elapsed;
	count ++;
}