mirror of
https://github.com/matrix-construct/construct
synced 2024-05-28 15:53:46 +02:00
modules/console: Show totals specific to args passed to db files cmd.
This commit is contained in:
parent
c6ce4d3229
commit
eff25f45f1
|
@ -5004,30 +5004,32 @@ try
|
||||||
db::database::get(dbname)
|
db::database::get(dbname)
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto _print_totals{[&out]
|
size_t totals(0);
|
||||||
(const auto &vector)
|
db::database::sst::info total;
|
||||||
|
total.name = "total"s;
|
||||||
|
const auto _add_totals{[&total, &totals]
|
||||||
|
(const auto &info)
|
||||||
{
|
{
|
||||||
db::database::sst::info total;
|
total.size += info.size;
|
||||||
total.name = "total"s;
|
total.data_size += info.data_size;
|
||||||
for(const auto &info : vector)
|
total.index_data_size += info.index_data_size;
|
||||||
{
|
total.index_root_size += info.index_root_size;
|
||||||
total.size += info.size;
|
total.filter_size += info.filter_size;
|
||||||
total.data_size += info.data_size;
|
total.keys_size += info.keys_size;
|
||||||
total.index_data_size += info.index_data_size;
|
total.values_size += info.values_size;
|
||||||
total.index_root_size += info.index_root_size;
|
total.index_parts += info.index_parts;
|
||||||
total.filter_size += info.filter_size;
|
total.data_blocks += info.data_blocks;
|
||||||
total.keys_size += info.keys_size;
|
total.entries += info.entries;
|
||||||
total.values_size += info.values_size;
|
total.range_deletes += info.range_deletes;
|
||||||
total.index_parts += info.index_parts;
|
total.num_reads += info.num_reads;
|
||||||
total.data_blocks += info.data_blocks;
|
totals++;
|
||||||
total.entries += info.entries;
|
}};
|
||||||
total.range_deletes += info.range_deletes;
|
|
||||||
total.num_reads += info.num_reads;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const auto _print_totals{[&out, &total, &totals]
|
||||||
|
{
|
||||||
_print_sst_info_header(out);
|
_print_sst_info_header(out);
|
||||||
_print_sst_info(out, total);
|
_print_sst_info(out, total);
|
||||||
out << "--- " << vector.size() << " files." << std::endl;
|
out << "--- " << totals << " files." << std::endl;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
if(colname == "*")
|
if(colname == "*")
|
||||||
|
@ -5050,10 +5052,11 @@ try
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
_print_sst_info(out, fileinfo);
|
_print_sst_info(out, fileinfo);
|
||||||
|
_add_totals(fileinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
out << std::endl;
|
out << std::endl;
|
||||||
_print_totals(vector);
|
_print_totals();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5061,6 +5064,7 @@ try
|
||||||
{
|
{
|
||||||
const db::database::sst::info info{database, colname};
|
const db::database::sst::info info{database, colname};
|
||||||
_print_sst_info_full(out, info);
|
_print_sst_info_full(out, info);
|
||||||
|
_add_totals(info);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5087,10 +5091,11 @@ try
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
_print_sst_info(out, info);
|
_print_sst_info(out, info);
|
||||||
|
_add_totals(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
out << std::endl;
|
out << std::endl;
|
||||||
_print_totals(vector);
|
_print_totals();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch(const std::out_of_range &e)
|
catch(const std::out_of_range &e)
|
||||||
|
|
Loading…
Reference in a new issue