1 : // Copyright 2012 Google Inc.
2 : //
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 : #ifndef SYZYGY_GRINDER_GRINDER_APP_H_
15 : #define SYZYGY_GRINDER_GRINDER_APP_H_
16 :
17 : #include "base/file_path.h"
18 : #include "syzygy/common/application.h"
19 : #include "syzygy/grinder/grinder.h"
20 :
21 m : namespace grinder {
22 :
23 : // The application class that takes care of running Grinder over a set of
24 : // profiler trace files.
25 m : class GrinderApp : public common::AppImplBase {
26 m : public:
27 m : GrinderApp();
28 :
29 : // The mode of processing we are performing.
30 m : enum Mode {
31 m : kProfile,
32 m : kCoverage,
33 m : };
34 :
35 : // @name Implementation of the AppImplbase interface.
36 : // @{
37 m : bool ParseCommandLine(const CommandLine* command_line);
38 m : int Run();
39 : // @}
40 :
41 : // @name Utility functions
42 : // @{
43 m : void PrintUsage(const FilePath& program,
44 m : const base::StringPiece& message);
45 : // @}
46 :
47 m : protected:
48 : // If @p path is an existing file, stores it in trace_files_, otherwise
49 : // expands it to the files it references and stores in trace_files_.
50 : // @returns true if path is an existing file, or a pattern that references
51 : // one or more files.
52 m : bool ExpandArgument(const FilePath& path);
53 :
54 m : std::vector<FilePath> trace_files_;
55 m : FilePath output_file_;
56 m : Mode mode_;
57 m : scoped_ptr<GrinderInterface> grinder_;
58 m : };
59 :
60 m : } // namespace grinder
61 :
62 : #endif // SYZYGY_GRINDER_GRINDER_APP_H_
|