Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Side by Side Diff: net/tools/fetch/fetch_client.cc

Issue 270062: Use ASCII strings for switch names. (Closed)
Patch Set: victory Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/tools/dump_cache/dump_cache.cc ('k') | net/tools/fetch/fetch_server.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/singleton.h" 10 #include "base/singleton.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 Singleton<Driver> driver_; 113 Singleton<Driver> driver_;
114 }; 114 };
115 115
116 int main(int argc, char**argv) { 116 int main(int argc, char**argv) {
117 base::AtExitManager exit; 117 base::AtExitManager exit;
118 StatsTable table("fetchclient", 50, 1000); 118 StatsTable table("fetchclient", 50, 1000);
119 table.set_current(&table); 119 table.set_current(&table);
120 120
121 CommandLine::Init(argc, argv); 121 CommandLine::Init(argc, argv);
122 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); 122 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
123 std::string url = WideToASCII(parsed_command_line.GetSwitchValue(L"url")); 123 std::string url = WideToASCII(parsed_command_line.GetSwitchValue("url"));
124 if (!url.length()) 124 if (!url.length())
125 usage(argv[0]); 125 usage(argv[0]);
126 int client_limit = 1; 126 int client_limit = 1;
127 if (parsed_command_line.HasSwitch(L"n")) 127 if (parsed_command_line.HasSwitch("n"))
128 StringToInt(WideToASCII(parsed_command_line.GetSwitchValue(L"n")), 128 StringToInt(WideToASCII(parsed_command_line.GetSwitchValue("n")),
129 &client_limit); 129 &client_limit);
130 bool use_cache = parsed_command_line.HasSwitch(L"use-cache"); 130 bool use_cache = parsed_command_line.HasSwitch("use-cache");
131 131
132 // Do work here. 132 // Do work here.
133 MessageLoop loop(MessageLoop::TYPE_IO); 133 MessageLoop loop(MessageLoop::TYPE_IO);
134 134
135 scoped_refptr<net::HostResolver> host_resolver( 135 scoped_refptr<net::HostResolver> host_resolver(
136 net::CreateSystemHostResolver()); 136 net::CreateSystemHostResolver());
137 137
138 scoped_refptr<net::ProxyService> proxy_service( 138 scoped_refptr<net::ProxyService> proxy_service(
139 net::ProxyService::CreateNull()); 139 net::ProxyService::CreateNull());
140 scoped_refptr<net::SSLConfigService> ssl_config_service( 140 scoped_refptr<net::SSLConfigService> ssl_config_service(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 if (bps > (1024*1024)) { 177 if (bps > (1024*1024)) {
178 bps /= (1024*1024); 178 bps /= (1024*1024);
179 units = "Mbps"; 179 units = "Mbps";
180 } else if (bps > 1024) { 180 } else if (bps > 1024) {
181 bps /= 1024; 181 bps /= 1024;
182 units = "Kbps"; 182 units = "Kbps";
183 } 183 }
184 printf("Bandwidth : %.2f%s\n", bps, units); 184 printf("Bandwidth : %.2f%s\n", bps, units);
185 } 185 }
186 186
187 if (parsed_command_line.HasSwitch(L"stats")) { 187 if (parsed_command_line.HasSwitch("stats")) {
188 // Dump the stats table. 188 // Dump the stats table.
189 printf("<stats>\n"); 189 printf("<stats>\n");
190 int counter_max = table.GetMaxCounters(); 190 int counter_max = table.GetMaxCounters();
191 for (int index=0; index < counter_max; index++) { 191 for (int index=0; index < counter_max; index++) {
192 std::string name(table.GetRowName(index)); 192 std::string name(table.GetRowName(index));
193 if (name.length() > 0) { 193 if (name.length() > 0) {
194 int value = table.GetRowValue(index); 194 int value = table.GetRowValue(index);
195 printf("%s:\t%d\n", name.c_str(), value); 195 printf("%s:\t%d\n", name.c_str(), value);
196 } 196 }
197 } 197 }
198 printf("</stats>\n"); 198 printf("</stats>\n");
199 } 199 }
200 return 0; 200 return 0;
201 } 201 }
OLDNEW
« no previous file with comments | « net/tools/dump_cache/dump_cache.cc ('k') | net/tools/fetch/fetch_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698