summaryrefslogtreecommitdiffstats
path: root/src/benchmark.c
blob: e2c14a6d381e3e803ad7e27120f189ec654cc876 (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
45
46
47
48
49
50
51
52
53
54
55
/*
 * This file is part of gapk (GSM Audio Pocket Knife).
 *
 * gapk is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * gapk 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with gapk.  If not, see <http://www.gnu.org/licenses/>.
 *
 * (C) 2014 Harald Welte <laforge@gnumonks.org>
 */

#include <stdio.h>

#include <gapk/benchmark.h>

struct benchmark_cycles codec_cycles[_CODEC_MAX];

void benchmark_dump(void)
{
	int i;

	for (i = 0; i < _CODEC_MAX; i++) {
		struct benchmark_cycles *bc = &codec_cycles[i];
		unsigned long long total;
		int j;

		if (bc->enc_used) {
			total = 0;
			for (j = 0; j < bc->enc_used; j++)
				total += bc->enc[j];

			printf("Codec %u (ENC): %llu cycles for %u frames => "
				"%llu cycles/frame\n", i, total, bc->enc_used,
				total / bc->enc_used);
		}

		if (bc->dec_used) {
			total = 0;
			for (j = 0; j < bc->dec_used; j++)
				total += bc->dec[j];

			printf("Codec %u (DEC): %llu cycles for %u frames => "
				"%llu cycles/frame\n", i, total, bc->dec_used,
				total / bc->dec_used);
		}
	}
}