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

Side by Side Diff: third_party/tcmalloc/chromium/src/tests/markidle_unittest.cc

Issue 9311003: Update the tcmalloc chromium branch to r144 (gperftools 2.0), and merge chromium-specific changes. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebasec Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2003, Google Inc. 1 // Copyright (c) 2003, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 17 matching lines...) Expand all
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 // --- 30 // ---
31 // Author: Sanjay Ghemawat 31 // Author: Sanjay Ghemawat
32 // 32 //
33 // MallocExtension::MarkThreadIdle() testing 33 // MallocExtension::MarkThreadIdle() testing
34 #include <stdio.h> 34 #include <stdio.h>
35 35
36 #include "config_for_unittests.h" 36 #include "config_for_unittests.h"
37 #include "base/logging.h" 37 #include "base/logging.h"
38 #include <google/malloc_extension.h> 38 #include <gperftools/malloc_extension.h>
39 #include "tests/testutil.h" // for RunThread() 39 #include "tests/testutil.h" // for RunThread()
40 40
41 // Helper routine to do lots of allocations 41 // Helper routine to do lots of allocations
42 static void TestAllocation() { 42 static void TestAllocation() {
43 static const int kNum = 100; 43 static const int kNum = 100;
44 void* ptr[kNum]; 44 void* ptr[kNum];
45 for (int size = 8; size <= 65536; size*=2) { 45 for (int size = 8; size <= 65536; size*=2) {
46 for (int i = 0; i < kNum; i++) { 46 for (int i = 0; i < kNum; i++) {
47 ptr[i] = malloc(size); 47 ptr[i] = malloc(size);
48 } 48 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 int main(int argc, char** argv) { 100 int main(int argc, char** argv) {
101 RunThread(&TestIdleUsage); 101 RunThread(&TestIdleUsage);
102 RunThread(&TestAllocation); 102 RunThread(&TestAllocation);
103 RunThread(&MultipleIdleCalls); 103 RunThread(&MultipleIdleCalls);
104 RunThread(&MultipleIdleNonIdlePhases); 104 RunThread(&MultipleIdleNonIdlePhases);
105 105
106 printf("PASS\n"); 106 printf("PASS\n");
107 return 0; 107 return 0;
108 } 108 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698