1 : // Copyright 2012 Google Inc. All Rights Reserved.
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 : //
15 : // Defines the InstrumentApp class, which implements the command-line
16 : // "instrument" tool.
17 :
18 : #ifndef SYZYGY_INSTRUMENT_INSTRUMENT_APP_H_
19 : #define SYZYGY_INSTRUMENT_INSTRUMENT_APP_H_
20 :
21 : #include "base/command_line.h"
22 : #include "base/files/file_path.h"
23 : #include "base/strings/string_piece.h"
24 : #include "base/time/time.h"
25 : #include "syzygy/application/application.h"
26 : #include "syzygy/instrument/instrumenter.h"
27 :
28 : namespace instrument {
29 :
30 : // Implements the "instrument" command-line application.
31 : //
32 : // Refer to kUsageFormatStr (referenced from InstrumentApp::Usage()) for
33 : // usage information.
34 : class InstrumentApp : public application::AppImplBase {
35 : public:
36 E : InstrumentApp()
37 : : application::AppImplBase("Instrumenter") {
38 E : }
39 :
40 : // @name Implementation of the AppImplBase interface.
41 : // @{
42 : bool ParseCommandLine(const base::CommandLine* command_line);
43 : int Run();
44 : // @}
45 :
46 : protected:
47 : // @name Utility members.
48 : // @{
49 : bool Usage(const base::CommandLine* command_line,
50 : const base::StringPiece& message) const;
51 : // @}
52 :
53 : // Used to parse old-style deprecated command-lines.
54 : // TODO(chrisha): Remove this once build scripts and profiling tools have
55 : // been updated.
56 : void ParseDeprecatedMode(const base::CommandLine* command_line);
57 :
58 : // The instrumenter we delegate to.
59 : scoped_ptr<InstrumenterInterface> instrumenter_;
60 : };
61 :
62 : } // namespace instrument
63 :
64 : #endif // SYZYGY_INSTRUMENT_INSTRUMENT_APP_H_
|