| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 const char* TestFunc() { | 21 const char* TestFunc() { |
| 22 PROFILE_F(); | 22 PROFILE_F(); |
| 23 rtc::Thread::SleepMs(kWaitMs); | 23 rtc::Thread::SleepMs(kWaitMs); |
| 24 return __FUNCTION__; | 24 return __FUNCTION__; |
| 25 } | 25 } |
| 26 | 26 |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 namespace rtc { | 29 namespace rtc { |
| 30 | 30 |
| 31 TEST(ProfilerTest, TestFunction) { | 31 // Disable this test due to flakiness; see bug 5947. |
| 32 #if defined(WEBRTC_LINUX) |
| 33 #define MAYBE_TestFunction DISABLED_TestFunction |
| 34 #else |
| 35 #define MAYBE_TestFunction TestFunction |
| 36 #endif |
| 37 TEST(ProfilerTest, MAYBE_TestFunction) { |
| 32 ASSERT_TRUE(Profiler::Instance()->Clear()); | 38 ASSERT_TRUE(Profiler::Instance()->Clear()); |
| 33 | 39 |
| 34 // Profile a long-running function. | 40 // Profile a long-running function. |
| 35 const char* function_name = TestFunc(); | 41 const char* function_name = TestFunc(); |
| 36 const ProfilerEvent* event = Profiler::Instance()->GetEvent(function_name); | 42 const ProfilerEvent* event = Profiler::Instance()->GetEvent(function_name); |
| 37 ASSERT_TRUE(event != NULL); | 43 ASSERT_TRUE(event != NULL); |
| 38 EXPECT_FALSE(event->is_started()); | 44 EXPECT_FALSE(event->is_started()); |
| 39 EXPECT_EQ(1, event->event_count()); | 45 EXPECT_EQ(1, event->event_count()); |
| 40 EXPECT_NEAR(kWaitSec, event->mean(), kTolerance * 3); | 46 EXPECT_NEAR(kWaitSec, event->mean(), kTolerance * 3); |
| 41 | 47 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 ASSERT_TRUE(Profiler::Instance()->Clear()); | 110 ASSERT_TRUE(Profiler::Instance()->Clear()); |
| 105 PROFILE_START("event"); | 111 PROFILE_START("event"); |
| 106 EXPECT_FALSE(Profiler::Instance()->Clear()); | 112 EXPECT_FALSE(Profiler::Instance()->Clear()); |
| 107 EXPECT_TRUE(Profiler::Instance()->GetEvent("event") != NULL); | 113 EXPECT_TRUE(Profiler::Instance()->GetEvent("event") != NULL); |
| 108 PROFILE_STOP("event"); | 114 PROFILE_STOP("event"); |
| 109 EXPECT_TRUE(Profiler::Instance()->Clear()); | 115 EXPECT_TRUE(Profiler::Instance()->Clear()); |
| 110 EXPECT_EQ(NULL, Profiler::Instance()->GetEvent("event")); | 116 EXPECT_EQ(NULL, Profiler::Instance()->GetEvent("event")); |
| 111 } | 117 } |
| 112 | 118 |
| 113 } // namespace rtc | 119 } // namespace rtc |
| OLD | NEW |