| 127 | |
| 128 | |
| 129 | void IBlockInputStream::readPrefix() |
| 130 | { |
| 131 | #ifndef NDEBUG |
| 132 | if (!read_prefix_is_called) |
| 133 | read_prefix_is_called = true; |
| 134 | else |
| 135 | throw Exception("readPrefix is called twice for " + getName() + " stream", ErrorCodes::LOGICAL_ERROR); |
| 136 | #endif |
| 137 | |
| 138 | if (!info.started) |
| 139 | { |
| 140 | info.total_stopwatch.start(); |
| 141 | info.cpu_thread_stopwatch.start(); |
| 142 | info.started = true; |
| 143 | } |
| 144 | /// start of read |
| 145 | UInt64 start_ns = info.total_stopwatch.elapsed(); |
| 146 | UInt64 start_cpu_ns = info.cpu_thread_stopwatch.elapsed(); |
| 147 | |
| 148 | readPrefixImpl(); |
| 149 | |
| 150 | forEachChild([&] (IBlockInputStream & child) |
| 151 | { |
| 152 | child.readPrefix(); |
| 153 | return false; |
| 154 | }); |
| 155 | |
| 156 | /// end of read, update wall time and cpu thread time of current stream |
| 157 | info.wall_time_ns += info.total_stopwatch.elapsed() - start_ns; |
| 158 | info.cpu_time_ns += info.cpu_thread_stopwatch.elapsed() - start_cpu_ns; |
| 159 | } |
| 160 | |
| 161 | |
| 162 | void IBlockInputStream::readSuffix() |