RawSpeed
fast raw decoding library
Loading...
Searching...
No Matches
CameraMetaDataBenchmark.cpp
Go to the documentation of this file.
1
/*
2
RawSpeed - RAW file decoder.
3
4
Copyright (C) 2018 Roman Lebedev
5
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Lesser General Public
8
License as published by the Free Software Foundation; either
9
version 2 of the License, or (at your option) any later version.
10
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Lesser General Public License for more details.
15
16
You should have received a copy of the GNU Lesser General Public
17
License along with this library; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
21
#include "rawspeedconfig.h"
22
#include "
metadata/CameraMetaData.h
"
23
#include <pugixml.hpp>
24
#include <benchmark/benchmark.h>
25
26
#ifndef HAVE_PUGIXML
27
#error This benchmark requires to be built with pugixml being present.
28
#endif
29
30
namespace
{
31
32
constexpr
const
char
*
const
CAMERASXML
=
33
RAWSPEED_SOURCE_DIR
"/data/cameras.xml"
;
34
35
void
BM_pugixml_load_cameras_xml
(benchmark::State& state) {
36
for
(
auto
_ : state) {
37
pugi::xml_document doc;
38
39
#if defined(__unix__) || defined(__APPLE__)
40
pugi::xml_parse_result result = doc.load_file(
CAMERASXML
);
41
#else
42
pugi::xml_parse_result result =
43
doc.load_file(pugi::as_wide(
CAMERASXML
).c_str());
44
#endif
45
46
benchmark::DoNotOptimize(doc);
47
benchmark::DoNotOptimize(result);
48
}
49
}
50
BENCHMARK
(
BM_pugixml_load_cameras_xml
)->Unit(benchmark::kMicrosecond);
51
52
void
BM_CameraMetaData
(benchmark::State& state) {
53
for
(
auto
_ : state) {
54
rawspeed::CameraMetaData
metadata
(
CAMERASXML
);
55
benchmark::DoNotOptimize(
metadata
);
56
}
57
}
58
BENCHMARK
(
BM_CameraMetaData
)->Unit(benchmark::kMicrosecond);
59
60
}
// namespace
61
62
BENCHMARK_MAIN
();
CameraMetaData.h
BENCHMARK_MAIN
BENCHMARK_MAIN()
rawspeed::CameraMetaData
Definition
CameraMetaData.h:47
metadata
static const rawspeed::CameraMetaData metadata
Definition
main.cpp:54
anonymous_namespace{CameraMetaDataBenchmark.cpp}::BM_pugixml_load_cameras_xml
void BM_pugixml_load_cameras_xml(benchmark::State &state)
Definition
CameraMetaDataBenchmark.cpp:35
anonymous_namespace{CameraMetaDataBenchmark.cpp}::BM_CameraMetaData
void BM_CameraMetaData(benchmark::State &state)
Definition
CameraMetaDataBenchmark.cpp:52
anonymous_namespace{CameraMetaDataBenchmark.cpp}::BENCHMARK
BENCHMARK(BM_pugixml_load_cameras_xml) -> Unit(benchmark::kMicrosecond)
anonymous_namespace{CameraMetaDataBenchmark.cpp}::CAMERASXML
constexpr const char *const CAMERASXML
Definition
CameraMetaDataBenchmark.cpp:32
bench
librawspeed
metadata
CameraMetaDataBenchmark.cpp
Generated by
1.15.0