2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file test_results_collector_commons.cpp
18 * @author Lukasz Wrzosek (l.wrzosek@samsung.com)
19 * @author Marcin Niesluchowski (m.niesluchow@samsung.com)
21 * @brief Source file containing definitions of collectors common
25 #include "dpl/test/test_results_collector_commons.h"
32 const std::string NO_VERBOSE_ARG = "--no-verbose";
36 const std::string COLLECTOR_NO_VERBOSE_HELP =
37 NO_VERBOSE_ARG + " - turns off verbosity\n" +
38 std::string(NO_VERBOSE_ARG.size(), ' ') + " verbosity turned on by default\n";
40 double get_milliseconds (const std::chrono::system_clock::duration& performanceTime)
42 return (static_cast<double>(std::chrono::duration_cast<std::chrono::microseconds>
43 (performanceTime).count()))/1000.0;
46 std::string CollectorFileHelp(const std::string &defaultFilename)
48 return "--file=<filename> - name of file for output\n"
49 " default - " + defaultFilename + "\n";
52 bool ParseCollectorFileArg(const std::string &arg, std::string &filename)
54 const std::string argname = "--file=";
55 if (arg.find(argname) == 0 ) {
56 filename = arg.substr(argname.size());
62 bool ParseCollectorNoVerboseArg(const std::string &arg, bool &verbosity)
64 if (arg != NO_VERBOSE_ARG)