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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 } | 121 } |
122 | 122 |
123 | 123 |
124 TEST(LogTest, WallClockStartTime) { | 124 TEST(LogTest, WallClockStartTime) { |
125 uint32_t time = LogMessage::WallClockStartTime(); | 125 uint32_t time = LogMessage::WallClockStartTime(); |
126 // Expect the time to be in a sensible range, e.g. > 2012-01-01. | 126 // Expect the time to be in a sensible range, e.g. > 2012-01-01. |
127 EXPECT_GT(time, 1325376000u); | 127 EXPECT_GT(time, 1325376000u); |
128 } | 128 } |
129 | 129 |
130 // Test the time required to write 1000 80-character logs to an unbuffered file. | 130 // Test the time required to write 1000 80-character logs to an unbuffered file. |
131 TEST(LogTest, Perf) { | 131 #if defined (WEBRTC_ANDROID) |
| 132 // Fails on Android: https://bugs.chromium.org/p/webrtc/issues/detail?id=4364. |
| 133 #define MAYBE_Perf DISABLED_Perf |
| 134 #else |
| 135 #define MAYBE_Perf Perf |
| 136 #endif |
| 137 |
| 138 TEST(LogTest, MAYBE_Perf) { |
132 Pathname path; | 139 Pathname path; |
133 EXPECT_TRUE(Filesystem::GetTemporaryFolder(path, true, NULL)); | 140 EXPECT_TRUE(Filesystem::GetTemporaryFolder(path, true, NULL)); |
134 path.SetPathname(Filesystem::TempFilename(path, "ut")); | 141 path.SetPathname(Filesystem::TempFilename(path, "ut")); |
135 | 142 |
136 LogSinkImpl<FileStream> stream; | 143 LogSinkImpl<FileStream> stream; |
137 EXPECT_TRUE(stream.Open(path.pathname(), "wb", NULL)); | 144 EXPECT_TRUE(stream.Open(path.pathname(), "wb", NULL)); |
138 stream.DisableBuffering(); | 145 stream.DisableBuffering(); |
139 LogMessage::AddLogToStream(&stream, LS_SENSITIVE); | 146 LogMessage::AddLogToStream(&stream, LS_SENSITIVE); |
140 | 147 |
141 int64_t start = TimeMillis(), finish; | 148 int64_t start = TimeMillis(), finish; |
142 std::string message('X', 80); | 149 std::string message('X', 80); |
143 for (int i = 0; i < 1000; ++i) { | 150 for (int i = 0; i < 1000; ++i) { |
144 LOG(LS_SENSITIVE) << message; | 151 LOG(LS_SENSITIVE) << message; |
145 } | 152 } |
146 finish = TimeMillis(); | 153 finish = TimeMillis(); |
147 | 154 |
148 LogMessage::RemoveLogToStream(&stream); | 155 LogMessage::RemoveLogToStream(&stream); |
149 stream.Close(); | 156 stream.Close(); |
150 Filesystem::DeleteFile(path); | 157 Filesystem::DeleteFile(path); |
151 | 158 |
152 LOG(LS_INFO) << "Average log time: " << TimeDiff(finish, start) << " ms"; | 159 LOG(LS_INFO) << "Average log time: " << TimeDiff(finish, start) << " ms"; |
153 } | 160 } |
154 | 161 |
155 } // namespace rtc | 162 } // namespace rtc |
OLD | NEW |