build: add code to build test/perf/perf-io.cc
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
|
||||
def configure(conf):
|
||||
pass
|
||||
|
||||
def build(bld):
|
||||
obj = bld.create_ns3_program('perf-io')
|
||||
obj.source = 'perf-io.cc'
|
||||
|
||||
|
||||
@@ -41,3 +41,9 @@ if(network IN_LIST libs_to_build)
|
||||
print-introspected-doxygen ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/utils/ ""
|
||||
)
|
||||
endif()
|
||||
|
||||
if(core IN_LIST ns3-all-enabled-modules)
|
||||
add_executable(perf-io perf/perf-io.cc)
|
||||
target_link_libraries(perf-io PRIVATE ${libcore})
|
||||
set_runtime_outputdirectory(perf-io ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/utils/perf/ "")
|
||||
endif()
|
||||
|
||||
@@ -83,7 +83,7 @@ PerfFile (FILE *file, uint32_t n, const char *buffer, uint32_t size)
|
||||
* \param size The buffer size.
|
||||
*/
|
||||
void
|
||||
PerfStream (ostream &stream, uint32_t n, const char *buffer, uint32_t size)
|
||||
PerfStream (std::ostream &stream, uint32_t n, const char *buffer, uint32_t size)
|
||||
{
|
||||
|
||||
for (uint32_t i = 0; i < n; ++i)
|
||||
@@ -121,7 +121,7 @@ main (int argc, char *argv[])
|
||||
//
|
||||
for (uint32_t i = 0; i < iter; ++i)
|
||||
{
|
||||
ofstream stream;
|
||||
std::ofstream stream;
|
||||
if (binmode)
|
||||
{
|
||||
stream.open ("streamtest", std::ios_base::binary | std::ios_base::out);
|
||||
@@ -134,11 +134,11 @@ main (int argc, char *argv[])
|
||||
uint64_t start = GetRealtimeInNs ();
|
||||
PerfStream (stream, n, buffer, 1024);
|
||||
uint64_t et = GetRealtimeInNs () - start;
|
||||
result = min (result, et);
|
||||
result = std::min (result, et);
|
||||
stream.close ();
|
||||
std::cout << "."; std::cout.flush ();
|
||||
}
|
||||
cout << std::endl;
|
||||
std::cout << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -32,3 +32,6 @@ def build(bld):
|
||||
obj = bld.create_ns3_program('print-introspected-doxygen', ['network'])
|
||||
obj.source = 'print-introspected-doxygen.cc'
|
||||
obj.use = [mod for mod in env['NS3_ENABLED_MODULES']]
|
||||
|
||||
obj = bld.create_ns3_program('perf-io', ['core'])
|
||||
obj.source = 'perf/perf-io.cc'
|
||||
Reference in New Issue
Block a user