mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-12 02:23:14 +00:00
Added test tool
This commit is contained in:
parent
71c4418876
commit
1c00953b3e
@ -11,6 +11,8 @@ namespace DB
|
|||||||
*
|
*
|
||||||
* Note: a class is used instead of a single function to avoid excessive file open/close on every use.
|
* Note: a class is used instead of a single function to avoid excessive file open/close on every use.
|
||||||
* pread is used to avoid lseek.
|
* pread is used to avoid lseek.
|
||||||
|
*
|
||||||
|
* Actual performance is from 1 to 5 million iterations per second.
|
||||||
*/
|
*/
|
||||||
class MemoryStatisticsOS
|
class MemoryStatisticsOS
|
||||||
{
|
{
|
||||||
|
@ -68,3 +68,6 @@ target_link_libraries (symbol_index PRIVATE clickhouse_common_io)
|
|||||||
|
|
||||||
add_executable (chaos_sanitizer chaos_sanitizer.cpp)
|
add_executable (chaos_sanitizer chaos_sanitizer.cpp)
|
||||||
target_link_libraries (chaos_sanitizer PRIVATE clickhouse_common_io)
|
target_link_libraries (chaos_sanitizer PRIVATE clickhouse_common_io)
|
||||||
|
|
||||||
|
add_executable (memory_statistics_os_perf memory_statistics_os_perf.cpp)
|
||||||
|
target_link_libraries (memory_statistics_os_perf PRIVATE clickhouse_common_io)
|
||||||
|
23
src/Common/tests/memory_statistics_os_perf.cpp
Normal file
23
src/Common/tests/memory_statistics_os_perf.cpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#include <Common/MemoryStatisticsOS.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char ** argv)
|
||||||
|
{
|
||||||
|
using namespace DB;
|
||||||
|
|
||||||
|
size_t num_iterations = argc >= 2 ? std::stoull(argv[1]) : 1000000;
|
||||||
|
MemoryStatisticsOS stats;
|
||||||
|
|
||||||
|
uint64_t counter = 0;
|
||||||
|
for (size_t i = 0; i < num_iterations; ++i)
|
||||||
|
{
|
||||||
|
MemoryStatisticsOS::Data data = stats.get();
|
||||||
|
counter += data.resident;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << (counter / num_iterations) << '\n';
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user