aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/src/hiperf.cc25
1 files changed, 19 insertions, 6 deletions
diff --git a/utils/src/hiperf.cc b/utils/src/hiperf.cc
index 66cd559cb..b62173be8 100644
--- a/utils/src/hiperf.cc
+++ b/utils/src/hiperf.cc
@@ -565,13 +565,18 @@ class HIperfServer {
content_objects_index_(0),
mask_((std::uint16_t)(1 << log2_content_object_buffer_size) - 1),
#ifndef _WIN32
- input_(io_service_, ::dup(STDIN_FILENO)),
+ input_(io_service_),
rtc_running_(false)
#endif
{
std::string buffer(configuration_.payload_size_, 'X');
std::cout << "Producing contents under name " << conf.name.getName()
<< std::endl;
+#ifndef _WIN32
+ if (configuration_.interactive_) {
+ input_.assign(::dup(STDIN_FILENO));
+ }
+#endif
for (int i = 0; i < (1 << log2_content_object_buffer_size); i++) {
content_objects_[i] = std::make_shared<ContentObject>(
@@ -605,15 +610,23 @@ class HIperfServer {
void produceContent(uint32_t suffix) {
core::Name name = configuration_.name.getName();
- std::string content(configuration_.download_size, '?');
+ auto b = utils::MemBuf::create(configuration_.download_size);
+ std::memset(b->writableData(), '?', configuration_.download_size);
+ b->append(configuration_.download_size);
uint32_t total;
+ utils::TimePoint t0 = utils::SteadyClock::now();
+
total = producer_socket_->produce(
- name, reinterpret_cast<const uint8_t *>(content.data()), content.size(),
- !configuration_.multiphase_produce_, suffix);
+ name, std::move(b), !configuration_.multiphase_produce_, suffix);
- std::cout << "Written " << total << "pieces of data in output buffer"
- << std::endl;
+ utils::TimePoint t1 = utils::SteadyClock::now();
+
+ std::cout
+ << "Written " << total
+ << " data packets in output buffer (Segmentation time: "
+ << std::chrono::duration_cast<utils::Microseconds>(t1 - t0).count()
+ << " us)" << std::endl;
}
std::shared_ptr<utils::Identity> setProducerIdentity(