Tommi
fe041643b4
Add utility to count the number of blocking thread invokes.
...
This is useful to understand how often we block in certain parts of the
api and track improvements/regressions.
There are two macros, both are only active for RTC_DCHECK_IS_ON builds:
* RTC_LOG_THREAD_BLOCK_COUNT()
Example:
void MyClass::MyFunction() {
RTC_LOG_THREAD_BLOCK_COUNT();
thread_->Invoke<void>([this](){ DoStuff(); });
}
When executing this function during a test, the output could be:
(my_file.cc:2): Blocking MyFunction: total=1 (actual=1, would=0)
The words 'actual' and 'would' reflect whether an actual thread switch
was made, or if in the case of a test using the same thread for more
than one role (e.g. signaling, worker, network are all the same thread)
that an actual thread switch did not occur but it would have occurred
in the case of having dedicated threads. The 'total' count is the sum.
* RTC_DCHECK_BLOCK_COUNT_NO_MORE_THAN(x)
Example:
void MyClass::MyFunction() {
RTC_LOG_THREAD_BLOCK_COUNT();
thread_->Invoke<void>([this](){ DoStuff(); });
thread_->Invoke<void>([this](){ MoreStuff(); });
RTC_DCHECK_BLOCK_COUNT_NO_MORE_THAN(1);
}
When a function is known to have blocking calls and we want to not
regress from the currently known number of blocking calls, we can use
this macro to state that at a certain point in a function, below
where RTC_LOG_THREAD_BLOCK_COUNT() is called, there must have occurred
no more than |x| (total) blocking calls. If more occur, a DCHECK will
hit and print out what the actual number of calls was:
# Fatal error in: my_file.cc, line 5
# last system error: 60
# Check failed: blocked_call_count_printer.GetTotalBlockedCallCount() <= 1 (2 vs. 1)
Bug: webrtc:12649
Change-Id: Ibac4f85f00b89680601dba54a651eac95a0f45d3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213782
Commit-Queue: Tommi <tommi@webrtc.org >
Reviewed-by: Harald Alvestrand <hta@webrtc.org >
Cr-Commit-Position: refs/heads/master@{#33632}
2021-04-07 10:02:41 +00:00
..
2021-02-11 10:39:03 +00:00
2021-03-24 15:49:31 +00:00
2021-01-15 17:00:05 +00:00
2019-11-27 12:52:48 +00:00
2021-03-29 10:15:44 +00:00
2020-06-08 12:59:40 +00:00
2020-11-09 10:47:55 +00:00
2020-05-26 20:27:34 +00:00
2021-02-12 11:53:16 +00:00
2021-03-25 15:59:05 +00:00
2021-03-19 10:05:13 +00:00
2020-01-21 12:13:11 +00:00
2020-11-04 14:53:13 +00:00
2020-04-02 09:54:27 +00:00
2021-01-27 19:16:46 +00:00
2021-01-29 08:24:43 +00:00
2021-01-29 08:24:43 +00:00
2021-01-29 08:24:43 +00:00
2020-03-02 11:36:58 +00:00
2020-01-28 19:16:18 +00:00
2019-02-20 16:02:59 +00:00
2019-10-15 09:07:44 +00:00
2021-01-15 17:00:05 +00:00
2021-02-10 15:04:55 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2020-02-03 21:19:57 +00:00
2020-02-03 21:19:57 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:05:20 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2020-07-08 11:41:20 +00:00
2020-07-08 11:41:20 +00:00
2019-07-03 13:30:01 +00:00
2021-01-29 21:56:38 +00:00
2020-12-11 09:58:40 +00:00
2020-12-11 09:58:40 +00:00
2020-12-11 09:58:40 +00:00
2020-03-02 20:55:28 +00:00
2020-03-02 20:55:28 +00:00
2020-03-02 20:55:28 +00:00
2019-01-11 17:11:39 +00:00
2020-09-29 12:57:20 +00:00
2021-02-10 15:04:55 +00:00
2020-05-26 20:27:34 +00:00
2020-05-29 11:42:06 +00:00
2021-03-25 12:00:11 +00:00
2019-11-15 11:48:42 +00:00
2019-11-15 11:48:42 +00:00
2019-11-15 11:48:42 +00:00
2019-07-08 13:45:15 +00:00
2019-03-31 11:55:09 +00:00
2021-01-29 08:24:43 +00:00
2020-11-26 08:41:36 +00:00
2020-11-26 08:41:36 +00:00
2020-11-18 20:49:08 +00:00
2020-11-09 10:47:55 +00:00
2020-11-18 20:49:08 +00:00
2020-09-29 10:19:20 +00:00
2021-01-21 18:14:14 +00:00
2021-01-22 16:20:22 +00:00
2021-01-22 16:20:22 +00:00
2020-01-15 13:36:58 +00:00
2019-01-11 17:11:39 +00:00
2018-11-28 18:25:07 +00:00
2019-05-15 23:54:07 +00:00
2019-05-10 07:07:19 +00:00
2019-05-10 07:07:19 +00:00
2018-11-28 18:25:07 +00:00
2019-10-15 09:07:44 +00:00
2020-06-04 09:55:12 +00:00
2020-07-08 20:38:54 +00:00
2021-02-10 15:04:55 +00:00
2018-11-28 18:25:07 +00:00
2019-04-11 16:35:18 +00:00
2019-04-11 16:35:18 +00:00
2020-02-10 12:21:17 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2021-03-25 12:00:11 +00:00
2020-11-23 14:58:39 +00:00
2020-04-16 14:21:41 +00:00
2020-04-16 14:21:41 +00:00
2021-03-29 09:47:33 +00:00
2021-03-29 08:05:39 +00:00
2021-03-29 09:47:33 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2019-08-08 08:29:18 +00:00
2018-12-17 17:33:06 +00:00
2020-02-10 12:21:17 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-10-15 09:07:44 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:05:20 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-04-24 20:57:20 +00:00
2021-01-15 17:00:05 +00:00
2020-12-10 11:04:58 +00:00
2019-12-03 19:43:12 +00:00
2020-09-30 13:58:29 +00:00
2021-03-29 08:05:39 +00:00
2019-07-08 13:45:15 +00:00
2021-03-29 11:04:47 +00:00
2020-09-21 20:42:59 +00:00
2021-02-22 12:53:23 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-10-25 12:07:32 +00:00
2019-10-25 12:07:32 +00:00
2018-11-28 18:25:07 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2021-01-11 07:53:03 +00:00
2020-09-25 11:44:02 +00:00
2020-09-25 11:44:02 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2020-11-26 01:00:22 +00:00
2020-01-10 19:03:12 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-09-17 15:47:29 +00:00
2020-03-02 11:36:58 +00:00
2020-03-02 11:36:58 +00:00
2021-03-22 09:41:27 +00:00
2021-01-15 17:00:05 +00:00
2020-04-02 07:48:36 +00:00
2020-04-02 07:48:36 +00:00
2020-08-13 20:50:23 +00:00
2020-08-13 20:50:23 +00:00
2020-11-09 10:47:55 +00:00
2021-03-15 10:50:31 +00:00
2020-03-24 11:48:42 +00:00
2020-03-24 11:48:42 +00:00
2020-03-30 13:02:46 +00:00
2021-03-15 10:50:31 +00:00
2021-03-15 10:50:31 +00:00
2021-03-15 10:50:31 +00:00
2020-09-07 12:57:15 +00:00
2019-07-08 13:45:15 +00:00
2020-05-06 20:19:49 +00:00
2019-01-11 17:11:39 +00:00
2020-07-08 20:38:54 +00:00
2020-05-14 19:33:26 +00:00
2020-12-11 09:58:40 +00:00
2020-12-11 09:58:40 +00:00
2020-11-09 10:47:55 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2020-12-11 09:58:40 +00:00
2020-12-11 09:58:40 +00:00
2020-12-11 09:58:40 +00:00
2020-12-11 09:58:40 +00:00
2020-12-11 09:58:40 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2020-12-11 09:58:40 +00:00
2020-12-11 09:58:40 +00:00
2020-12-11 09:58:40 +00:00
2020-12-11 09:58:40 +00:00
2020-12-11 09:58:40 +00:00
2021-01-29 08:24:43 +00:00
2020-10-06 14:10:36 +00:00
2021-02-10 15:04:55 +00:00
2020-12-15 13:59:32 +00:00
2021-01-15 17:00:05 +00:00
2021-02-15 14:38:47 +00:00
2021-02-15 14:38:47 +00:00
2020-05-17 17:22:01 +00:00
2019-03-04 12:42:10 +00:00
2020-10-26 09:55:26 +00:00
2019-07-08 13:45:15 +00:00
2021-02-10 15:04:55 +00:00
2019-02-16 11:11:45 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-09-17 15:47:29 +00:00
2019-03-28 13:33:30 +00:00
2019-07-08 13:45:15 +00:00
2018-10-23 11:32:56 +00:00
2020-09-18 17:42:53 +00:00
2021-01-07 16:40:50 +00:00
2019-07-08 13:45:15 +00:00
2020-07-08 20:38:54 +00:00
2020-09-29 10:19:20 +00:00
2020-01-15 13:46:38 +00:00
2020-05-25 12:14:44 +00:00
2020-05-25 12:14:44 +00:00
2020-01-15 13:46:38 +00:00
2020-12-15 12:17:12 +00:00
2020-12-15 12:17:12 +00:00
2019-01-11 17:11:39 +00:00
2021-01-22 16:20:22 +00:00
2021-03-30 09:23:22 +00:00
2019-11-26 14:05:20 +00:00
2019-07-08 13:45:15 +00:00
2020-09-18 17:42:53 +00:00
2020-04-15 09:30:07 +00:00
2020-12-11 09:58:40 +00:00
2019-10-15 09:07:44 +00:00
2020-03-21 18:53:46 +00:00
2020-03-21 18:53:46 +00:00
2021-03-29 20:44:03 +00:00
2018-11-28 18:25:07 +00:00
2018-11-26 19:20:27 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-04-09 17:18:20 +00:00
2019-01-11 17:11:39 +00:00
2019-12-10 08:32:10 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2020-01-03 18:42:32 +00:00
2020-12-10 11:04:58 +00:00
2019-01-11 17:11:39 +00:00
2020-01-10 19:03:12 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2020-09-07 12:57:15 +00:00
2020-08-31 20:26:37 +00:00
2019-07-08 13:45:15 +00:00
2021-02-05 11:20:36 +00:00
2020-05-14 19:33:26 +00:00
2019-01-11 17:11:39 +00:00
2020-04-14 11:00:49 +00:00
2020-12-11 09:58:40 +00:00
2019-10-15 09:07:44 +00:00
2019-09-17 15:47:29 +00:00
2019-10-15 09:07:44 +00:00
2020-12-11 09:58:40 +00:00
2020-12-11 09:58:40 +00:00
2021-02-22 12:53:23 +00:00
2020-10-29 21:08:10 +00:00
2020-12-11 09:58:40 +00:00
2020-03-21 18:53:46 +00:00
2021-02-22 12:53:23 +00:00
2020-10-05 13:46:03 +00:00
2020-10-05 13:46:03 +00:00
2019-07-08 13:45:15 +00:00
2019-08-29 14:16:23 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2018-10-23 11:32:56 +00:00
2019-07-30 19:35:37 +00:00
2020-09-17 13:18:25 +00:00
2020-09-17 13:18:25 +00:00
2020-05-26 20:27:34 +00:00
2021-01-15 17:59:05 +00:00
2021-02-25 10:48:55 +00:00
2021-02-15 22:38:46 +00:00
2019-03-19 18:11:52 +00:00
2020-05-04 13:47:35 +00:00
2020-03-18 16:06:09 +00:00
2019-02-20 17:08:53 +00:00
2020-07-08 20:38:54 +00:00
2019-02-12 10:58:36 +00:00
2020-07-08 20:38:54 +00:00
2019-02-21 14:36:07 +00:00
2021-01-29 08:24:43 +00:00
2020-07-08 20:38:54 +00:00
2019-02-21 09:33:42 +00:00
2019-04-10 10:27:07 +00:00
2019-09-17 15:47:29 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-09-17 15:47:29 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2021-03-29 13:04:09 +00:00
2019-07-08 13:45:15 +00:00
2020-01-20 14:07:16 +00:00
2021-04-07 10:02:41 +00:00
2021-04-07 10:02:41 +00:00
2021-04-07 10:02:41 +00:00
2020-02-10 12:21:17 +00:00
2021-02-23 14:53:22 +00:00
2021-02-23 14:53:22 +00:00
2020-03-10 17:22:54 +00:00
2020-03-10 17:22:54 +00:00
2020-03-10 17:22:54 +00:00
2019-11-28 15:58:24 +00:00
2019-07-08 13:45:15 +00:00
2019-02-09 00:55:14 +00:00
2019-02-09 00:55:14 +00:00
2020-10-07 01:26:06 +00:00
2020-10-07 01:26:06 +00:00
2021-03-10 20:06:22 +00:00
2021-03-10 20:06:22 +00:00
2021-02-11 09:17:23 +00:00
2019-10-15 09:17:36 +00:00
2019-04-09 12:28:04 +00:00
2021-02-10 15:04:55 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-10-22 16:15:56 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-05-22 10:32:25 +00:00
2018-11-28 18:25:07 +00:00
2019-07-08 13:45:15 +00:00