Harald Welte | 7a04624 | 2014-05-08 19:18:01 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of gapk (GSM Audio Pocket Knife). |
| 3 | * |
| 4 | * gapk is free software: you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation, either version 3 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * gapk is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with gapk. If not, see <http://www.gnu.org/licenses/>. |
| 16 | * |
| 17 | * (C) 2014 Harald Welte <laforge@gnumonks.org> |
| 18 | */ |
| 19 | |
| 20 | #include <stdio.h> |
| 21 | |
| 22 | #include <gapk/benchmark.h> |
| 23 | |
| 24 | struct benchmark_cycles codec_cycles[_CODEC_MAX]; |
| 25 | |
| 26 | void benchmark_dump(void) |
| 27 | { |
| 28 | int i; |
| 29 | |
| 30 | for (i = 0; i < _CODEC_MAX; i++) { |
| 31 | struct benchmark_cycles *bc = &codec_cycles[i]; |
| 32 | unsigned long long total; |
| 33 | int j; |
| 34 | |
| 35 | if (bc->enc_used) { |
| 36 | total = 0; |
| 37 | for (j = 0; j < bc->enc_used; j++) |
| 38 | total += bc->enc[j]; |
| 39 | |
Sylvain Munaut | d392a89 | 2015-12-30 10:45:22 +0100 | [diff] [blame] | 40 | fprintf(stderr, |
| 41 | "Codec %u (ENC): %llu cycles for %u frames => " |
Harald Welte | 7a04624 | 2014-05-08 19:18:01 +0200 | [diff] [blame] | 42 | "%llu cycles/frame\n", i, total, bc->enc_used, |
| 43 | total / bc->enc_used); |
| 44 | } |
| 45 | |
| 46 | if (bc->dec_used) { |
| 47 | total = 0; |
| 48 | for (j = 0; j < bc->dec_used; j++) |
| 49 | total += bc->dec[j]; |
| 50 | |
Sylvain Munaut | d392a89 | 2015-12-30 10:45:22 +0100 | [diff] [blame] | 51 | fprintf(stderr, |
| 52 | "Codec %u (DEC): %llu cycles for %u frames => " |
Harald Welte | 7a04624 | 2014-05-08 19:18:01 +0200 | [diff] [blame] | 53 | "%llu cycles/frame\n", i, total, bc->dec_used, |
| 54 | total / bc->dec_used); |
| 55 | } |
| 56 | } |
| 57 | } |