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

Side by Side Diff: net/tools/stress_cache/stress_cache.cc

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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/quic/test_tools/simple_client.cc ('k') | net/udp/udp_client_socket.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 is a simple application that stress-tests the crash recovery of the disk 5 // This is a simple application that stress-tests the crash recovery of the disk
6 // cache. The main application starts a copy of itself on a loop, checking the 6 // cache. The main application starts a copy of itself on a loop, checking the
7 // exit code of the child process. When the child dies in an unexpected way, 7 // exit code of the child process. When the child dies in an unexpected way,
8 // the main application quits. 8 // the main application quits.
9 9
10 // The child application has two threads: one to exercise the cache in an 10 // The child application has two threads: one to exercise the cache in an
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 289
290 base::MessageLoop::current()->task_runner()->PostTask(FROM_HERE, 290 base::MessageLoop::current()->task_runner()->PostTask(FROM_HERE,
291 base::Bind(&LoopTask)); 291 base::Bind(&LoopTask));
292 } 292 }
293 293
294 // This thread will loop forever, adding and removing entries from the cache. 294 // This thread will loop forever, adding and removing entries from the cache.
295 // iteration is the current crash cycle, so the entries on the cache are marked 295 // iteration is the current crash cycle, so the entries on the cache are marked
296 // to know which instance of the application wrote them. 296 // to know which instance of the application wrote them.
297 void StressTheCache(int iteration) { 297 void StressTheCache(int iteration) {
298 int cache_size = 0x2000000; // 32MB. 298 int cache_size = 0x2000000; // 32MB.
299 uint32 mask = 0xfff; // 4096 entries. 299 uint32_t mask = 0xfff; // 4096 entries.
300 300
301 base::FilePath path; 301 base::FilePath path;
302 PathService::Get(base::DIR_TEMP, &path); 302 PathService::Get(base::DIR_TEMP, &path);
303 path = path.AppendASCII("cache_test_stress"); 303 path = path.AppendASCII("cache_test_stress");
304 304
305 base::Thread cache_thread("CacheThread"); 305 base::Thread cache_thread("CacheThread");
306 if (!cache_thread.StartWithOptions( 306 if (!cache_thread.StartWithOptions(
307 base::Thread::Options(base::MessageLoop::TYPE_IO, 0))) 307 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)))
308 return; 308 return;
309 309
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 long int iteration = strtol(argv[1], &end, 0); 433 long int iteration = strtol(argv[1], &end, 0);
434 434
435 if (!StartCrashThread()) { 435 if (!StartCrashThread()) {
436 printf("failed to start thread\n"); 436 printf("failed to start thread\n");
437 return kError; 437 return kError;
438 } 438 }
439 439
440 StressTheCache(iteration); 440 StressTheCache(iteration);
441 return 0; 441 return 0;
442 } 442 }
OLDNEW
« no previous file with comments | « net/tools/quic/test_tools/simple_client.cc ('k') | net/udp/udp_client_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698