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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 TEST(LogTest, Perf) { | 131 TEST(LogTest, Perf) { |
132 Pathname path; | 132 Pathname path; |
133 EXPECT_TRUE(Filesystem::GetTemporaryFolder(path, true, NULL)); | 133 EXPECT_TRUE(Filesystem::GetTemporaryFolder(path, true, NULL)); |
134 path.SetPathname(Filesystem::TempFilename(path, "ut")); | 134 path.SetPathname(Filesystem::TempFilename(path, "ut")); |
135 | 135 |
136 LogSinkImpl<FileStream> stream; | 136 LogSinkImpl<FileStream> stream; |
137 EXPECT_TRUE(stream.Open(path.pathname(), "wb", NULL)); | 137 EXPECT_TRUE(stream.Open(path.pathname(), "wb", NULL)); |
138 stream.DisableBuffering(); | 138 stream.DisableBuffering(); |
139 LogMessage::AddLogToStream(&stream, LS_SENSITIVE); | 139 LogMessage::AddLogToStream(&stream, LS_SENSITIVE); |
140 | 140 |
141 uint32_t start = Time(), finish; | 141 int64_t start = TimeMillis(), finish; |
142 std::string message('X', 80); | 142 std::string message('X', 80); |
143 for (int i = 0; i < 1000; ++i) { | 143 for (int i = 0; i < 1000; ++i) { |
144 LOG(LS_SENSITIVE) << message; | 144 LOG(LS_SENSITIVE) << message; |
145 } | 145 } |
146 finish = Time(); | 146 finish = TimeMillis(); |
147 | 147 |
148 LogMessage::RemoveLogToStream(&stream); | 148 LogMessage::RemoveLogToStream(&stream); |
149 stream.Close(); | 149 stream.Close(); |
150 Filesystem::DeleteFile(path); | 150 Filesystem::DeleteFile(path); |
151 | 151 |
152 LOG(LS_INFO) << "Average log time: " << TimeDiff(finish, start) << " us"; | 152 LOG(LS_INFO) << "Average log time: " << TimeDiff(finish, start) << " ms"; |
153 } | 153 } |
154 | 154 |
155 } // namespace rtc | 155 } // namespace rtc |
OLD | NEW |