1 : // Copyright 2013 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 : #include "syzygy/sampler/sampler_app.h"
16 :
17 : namespace sampler {
18 :
19 : namespace {
20 :
21 : const char kUsageFormatStr[] =
22 : "Usage: %ls\n"
23 : "\n"
24 : " A tool that polls running processes and profiles modules of interest.\n"
25 : "\n";
26 :
27 : } // namespace
28 :
29 E : SamplerApp::SamplerApp() : common::AppImplBase("Sampler") {
30 E : }
31 :
32 E : bool SamplerApp::ParseCommandLine(const CommandLine* command_line) {
33 E : DCHECK(command_line != NULL);
34 :
35 : // TODO(chrisha): Implement me!
36 E : return PrintUsage(command_line->GetProgram(), "Not yet implemented!");
37 E : }
38 :
39 : int SamplerApp::Run() {
40 : // TODO(chrisha): Implement me!
41 : return 1;
42 : }
43 :
44 : bool SamplerApp::PrintUsage(const base::FilePath& program,
45 E : const base::StringPiece& message) {
46 E : if (!message.empty()) {
47 E : ::fwrite(message.data(), 1, message.length(), out());
48 E : ::fprintf(out(), "\n\n");
49 : }
50 :
51 E : ::fprintf(out(), kUsageFormatStr, program.BaseName().value().c_str());
52 :
53 E : return false;
54 E : }
55 :
56 : } // namespace sampler
|