summaryrefslogtreecommitdiffstats
path: root/trace/record/record-client-base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'trace/record/record-client-base.cc')
-rw-r--r--trace/record/record-client-base.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/trace/record/record-client-base.cc b/trace/record/record-client-base.cc
index d9e1eea..607a250 100644
--- a/trace/record/record-client-base.cc
+++ b/trace/record/record-client-base.cc
@@ -89,15 +89,22 @@ void FileDescriptor::Destroy() {
}
void Client::Run() {
- while (stop_ == 0) {
- int buf[8192];
- ssize_t n = input_.Read(buf, sizeof(buf));
+ uint64_t todo = UINT64_MAX;
+
+ if (limit_ != 0) {
+ todo = limit_;
+ }
- if (n > 0) {
- rtems_record_client_run(&base_, buf, static_cast<size_t>(n));
- } else {
+ while (stop_ == 0 && todo > 0) {
+ int buf[8192];
+ size_t m = std::min(sizeof(buf), todo);
+ ssize_t n = input_.Read(buf, m);
+ if (n <= 0) {
break;
}
+
+ rtems_record_client_run(&base_, buf, static_cast<size_t>(n));
+ todo -= static_cast<size_t>(n);
}
}