| OLD | NEW |
| 1 // Copyright (c) 2005, Google Inc. | 1 // Copyright (c) 2005, 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include <stdio.h> | 42 #include <stdio.h> |
| 43 #include <fcntl.h> // for mkdir() | 43 #include <fcntl.h> // for mkdir() |
| 44 #include <sys/stat.h> // for mkdir() on freebsd and os x | 44 #include <sys/stat.h> // for mkdir() on freebsd and os x |
| 45 #ifdef HAVE_UNISTD_H | 45 #ifdef HAVE_UNISTD_H |
| 46 #include <unistd.h> // for fork() | 46 #include <unistd.h> // for fork() |
| 47 #endif | 47 #endif |
| 48 #include <sys/wait.h> // for wait() | 48 #include <sys/wait.h> // for wait() |
| 49 #include <string> | 49 #include <string> |
| 50 #include "base/basictypes.h" | 50 #include "base/basictypes.h" |
| 51 #include "base/logging.h" | 51 #include "base/logging.h" |
| 52 #include <google/heap-profiler.h> | 52 #include <gperftools/heap-profiler.h> |
| 53 | 53 |
| 54 using std::string; | 54 using std::string; |
| 55 | 55 |
| 56 static const int kMaxCount = 100000; | 56 static const int kMaxCount = 100000; |
| 57 int* g_array[kMaxCount]; // an array of int-vectors | 57 int* g_array[kMaxCount]; // an array of int-vectors |
| 58 | 58 |
| 59 static ATTRIBUTE_NOINLINE void Allocate(int start, int end, int size) { | 59 static ATTRIBUTE_NOINLINE void Allocate(int start, int end, int size) { |
| 60 for (int i = start; i < end; ++i) { | 60 for (int i = start; i < end; ++i) { |
| 61 if (i < kMaxCount) | 61 if (i < kMaxCount) |
| 62 g_array[i] = new int[size]; | 62 g_array[i] = new int[size]; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 return execl(argv[0], argv[0], NULL); // run child with no args | 154 return execl(argv[0], argv[0], NULL); // run child with no args |
| 155 default: | 155 default: |
| 156 wait(NULL); // we'll let the kids run one at a time | 156 wait(NULL); // we'll let the kids run one at a time |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 | 159 |
| 160 printf("DONE.\n"); | 160 printf("DONE.\n"); |
| 161 | 161 |
| 162 return 0; | 162 return 0; |
| 163 } | 163 } |
| OLD | NEW |