1 /**
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "libpandabase/utils/logger.h"
17 #include "tools/sampler/aspt_converter.h"
18
19 namespace panda::tooling::sampler {
20
Main(int argc,const char ** argv)21 int Main(int argc, const char **argv)
22 {
23 panda::Span<const char *> sp(argv, argc);
24
25 ArgsParser parser;
26 if (!parser.Parse(sp)) {
27 parser.Help();
28 return 1;
29 }
30 const Options &cliOptions = parser.GetOptions();
31
32 Logger::InitializeStdLogging(Logger::Level::INFO, Logger::ComponentMaskFromString("profiler"));
33
34 AsptConverter asptConv(cliOptions.GetInput().c_str());
35 if (!asptConv.RunWithOptions(cliOptions)) {
36 return 1;
37 }
38
39 return 0;
40 }
41
42 } // namespace panda::tooling::sampler
43
main(int argc,const char ** argv)44 int main(int argc, const char **argv)
45 {
46 return panda::tooling::sampler::Main(argc, argv);
47 }
48