mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
dbms: development [#CONV-2944].
This commit is contained in:
parent
d9aced1d0a
commit
f3b5e278cd
@ -1,16 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <Poco/SharedPtr.h>
|
||||
#include <Poco/Stopwatch.h>
|
||||
|
||||
#include <DB/Core/Names.h>
|
||||
|
||||
#include <DB/DataStreams/IBlockInputStream.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
using Poco::SharedPtr;
|
||||
|
||||
|
||||
/// Информация для профайлинга.
|
||||
struct BlockStreamProfileInfo
|
||||
@ -23,6 +22,8 @@ struct BlockStreamProfileInfo
|
||||
size_t blocks;
|
||||
size_t bytes;
|
||||
|
||||
String column_names;
|
||||
|
||||
BlockStreamProfileInfo() : started(false), rows(0), blocks(0), bytes(0) {}
|
||||
|
||||
void update(Block & block);
|
||||
|
@ -13,12 +13,16 @@ void BlockStreamProfileInfo::update(Block & block)
|
||||
rows += block.rows();
|
||||
for (size_t i = 0; i < block.columns(); ++i)
|
||||
bytes += block.getByPosition(i).column->byteSize();
|
||||
|
||||
if (column_names.empty())
|
||||
column_names = block.dumpNames();
|
||||
}
|
||||
|
||||
|
||||
void BlockStreamProfileInfo::print(std::ostream & ostr) const
|
||||
{
|
||||
ostr << std::fixed << std::setprecision(2)
|
||||
<< "Columns: " << column_names << std::endl
|
||||
<< "Elapsed: " << work_stopwatch.elapsed() / 1000000.0 << " sec. "
|
||||
<< "(" << work_stopwatch.elapsed() * 100.0 / total_stopwatch.elapsed() << "%), " << std::endl
|
||||
<< "Rows: " << rows << ", per second: " << rows * 1000000 / work_stopwatch.elapsed() << ", " << std::endl
|
||||
|
Loading…
Reference in New Issue
Block a user