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

Side by Side Diff: chrome/tools/perf/flush_cache/flush_cache.cc

Issue 9774: * Revert "Por rt flush_cache tool." (Closed)
Patch Set: Created 12 years, 1 month 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 | « chrome/tools/perf/flush_cache/SConscript ('k') | net/disk_cache/disk_cache_perftest.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // This little program attempts to flush the disk cache for some files. 5 // This little program attempts to flush the disk cache for some files.
6 // It's useful for testing Chrome with a cold database. 6 // It's useful for testing Chrome with a cold database.
7 7
8 #include "build/build_config.h"
9
10 #include "base/file_path.h"
11 #include "base/file_util.h"
12 #include "base/string_piece.h" 8 #include "base/string_piece.h"
13 #include "base/process_util.h" 9 #include "base/process_util.h"
14 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
11 #include "chrome/test/test_file_util.h"
15 12
16 int main(int argc, const char* argv[]) { 13 int main(int argc, const char* argv[]) {
17 process_util::EnableTerminationOnHeapCorruption(); 14 process_util::EnableTerminationOnHeapCorruption();
18 if (argc <= 1) { 15 if (argc <= 1) {
19 fprintf(stderr, "flushes disk cache for files\n"); 16 fprintf(stderr, "flushes disk cache for files\n");
20 fprintf(stderr, "usage: %s <filenames>\n", argv[0]); 17 fprintf(stderr, "usage: %s <filenames>\n", argv[0]);
21 return 1; 18 return 1;
22 } 19 }
23 20
24 for (int i = 1; i < argc; ++i) { 21 for (int i = 1; i < argc; ++i) {
25 #if defined(OS_POSIX)
26 std::string filename(argv[i]);
27 #elif defined(OS_WIN)
28 std::wstring filename = base::SysNativeMBToWide(argv[i]); 22 std::wstring filename = base::SysNativeMBToWide(argv[i]);
29 #endif 23 if (!file_util::EvictFileFromSystemCache(filename.c_str())) {
30 if (!file_util::EvictFileFromSystemCache(FilePath(filename))) {
31 fprintf(stderr, "Failed to evict %s from cache -- is it a directory?\n", 24 fprintf(stderr, "Failed to evict %s from cache -- is it a directory?\n",
32 argv[i]); 25 argv[i]);
33 } 26 }
34 } 27 }
35 28
36 return 0; 29 return 0;
37 } 30 }
38 31
OLDNEW
« no previous file with comments | « chrome/tools/perf/flush_cache/SConscript ('k') | net/disk_cache/disk_cache_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698