dbms: development [#CONV-2944].

This commit is contained in:
Alexey Milovidov 2011-09-05 00:51:25 +00:00
parent d9aced1d0a
commit f3b5e278cd
2 changed files with 8 additions and 3 deletions

View File

@ -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);

View File

@ -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