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

Unified Diff: third_party/tcmalloc/chromium/src/tests/profile-handler_unittest.cc

Issue 440027: Merge r77 from upstream tcmalloc to the local chromium branch.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/tcmalloc/chromium/src/tests/profile-handler_unittest.cc
===================================================================
--- third_party/tcmalloc/chromium/src/tests/profile-handler_unittest.cc (revision 33071)
+++ third_party/tcmalloc/chromium/src/tests/profile-handler_unittest.cc (working copy)
@@ -8,9 +8,8 @@
#include "profile-handler.h"
#include <assert.h>
-#include <pthread.h>
#include <sys/time.h>
-#include <time.h>
+#include <pthread.h>
#include "base/logging.h"
#include "base/simple_mutex.h"
@@ -47,11 +46,11 @@
bool joinable_;
};
-// timespec of the sleep interval. To ensure a SIGPROF timer interrupt under
-// heavy load, this is set to a 20x of ProfileHandler timer interval (i.e 100Hz)
+// Sleep interval in usecs. To ensure a SIGPROF timer interrupt under heavy
+// load, this is set to a 20x of ProfileHandler timer interval (i.e 100Hz)
// TODO(nabeelmian) Under very heavy loads, the worker thread may not accumulate
// enough cpu usage to get a profile tick.
-const struct timespec sleep_interval = { 0, 200000000 }; // 200 ms
+int kSleepInterval = 200000;
// Whether each thread has separate timers.
static bool timer_separate_ = false;
@@ -214,7 +213,7 @@
busy_worker_->Start();
// Wait for worker to start up and register with the ProfileHandler.
// TODO(nabeelmian) This may not work under very heavy load.
- nanosleep(&sleep_interval, NULL);
+ usleep(kSleepInterval);
}
// Stops the worker thread.
@@ -258,7 +257,7 @@
uint64 interrupts_before = GetInterruptCount();
// Sleep for a bit and check that tick counter is making progress.
int old_tick_count = tick_counter;
- nanosleep(&sleep_interval, NULL);
+ usleep(kSleepInterval);
int new_tick_count = tick_counter;
EXPECT_GT(new_tick_count, old_tick_count);
uint64 interrupts_after = GetInterruptCount();
@@ -269,7 +268,7 @@
void VerifyUnregistration(const int& tick_counter) {
// Sleep for a bit and check that tick counter is not making progress.
int old_tick_count = tick_counter;
- nanosleep(&sleep_interval, NULL);
+ usleep(kSleepInterval);
int new_tick_count = tick_counter;
EXPECT_EQ(new_tick_count, old_tick_count);
// If no callbacks, signal handler and shared timer should be disabled.
@@ -298,7 +297,7 @@
}
// Verify that the ProfileHandler is not accumulating profile ticks.
uint64 interrupts_before = GetInterruptCount();
- nanosleep(&sleep_interval, NULL);
+ usleep(kSleepInterval);
uint64 interrupts_after = GetInterruptCount();
EXPECT_EQ(interrupts_after, interrupts_before);
}

Powered by Google App Engine
This is Rietveld 408576698