blob: 925d9dbe43be9e7bcbc114e90fb196d50bbf36de [file] [log] [blame]
Matteo Martincigh79250ab2018-09-04 16:28:10 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// See LICENSE file in the project root for full license information.
4//
5
6#include "ArmnnDriverImpl.hpp"
7#include "../SystemPropertiesUtils.hpp"
8
9#include <log/log.h>
10
11using namespace std;
12using namespace android;
13using namespace android::nn;
14using namespace android::hardware;
15
16namespace
17{
18
19const char *g_Float32PerformanceExecTimeName = "ArmNN.float32Performance.execTime";
20const char *g_Float32PerformancePowerUsageName = "ArmNN.float32Performance.powerUsage";
21const char *g_Quantized8PerformanceExecTimeName = "ArmNN.quantized8Performance.execTime";
22const char *g_Quantized8PerformancePowerUsageName = "ArmNN.quantized8Performance.powerUsage";
23
24} // anonymous namespace
25
26namespace armnn_driver
27{
28namespace V1_0
29{
30
31Return<void> ArmnnDriverImpl::getCapabilities(
32 const armnn::IRuntimePtr& runtime,
33 neuralnetworks::V1_0::IDevice::getCapabilities_cb cb)
34{
35 ALOGV("V1_0::ArmnnDriverImpl::getCapabilities()");
36
37 neuralnetworks::V1_0::Capabilities capabilities;
38 if (runtime)
39 {
40 capabilities.float32Performance.execTime =
41 ParseSystemProperty(g_Float32PerformanceExecTimeName, .1f);
42
43 capabilities.float32Performance.powerUsage =
44 ParseSystemProperty(g_Float32PerformancePowerUsageName, .1f);
45
46 capabilities.quantized8Performance.execTime =
47 ParseSystemProperty(g_Quantized8PerformanceExecTimeName, .1f);
48
49 capabilities.quantized8Performance.powerUsage =
50 ParseSystemProperty(g_Quantized8PerformancePowerUsageName, .1f);
51
52 cb(ErrorStatus::NONE, capabilities);
53 }
54 else
55 {
56 capabilities.float32Performance.execTime = 0;
57 capabilities.float32Performance.powerUsage = 0;
58 capabilities.quantized8Performance.execTime = 0;
59 capabilities.quantized8Performance.powerUsage = 0;
60
61 cb(ErrorStatus::DEVICE_UNAVAILABLE, capabilities);
62 }
63
64 return Void();
65}
66
67} // namespace armnn_driver::V1_0
68} // namespace armnn_driver