Skip to content

Commit

Permalink
Merge 2d18a16 into 17fdfc0
Browse files Browse the repository at this point in the history
  • Loading branch information
bmerry committed Nov 19, 2021
2 parents 17fdfc0 + 2d18a16 commit b7b40ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
5 changes: 2 additions & 3 deletions src/spead2/tools/recv_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ async def run_stream(stream, name, args):
except (spead2.Stopped, asyncio.CancelledError):
print(f"Shutting down stream {name} after {num_heaps} heaps")
stats = stream.stats
for key in dir(stats):
if not key.startswith('_'):
print("{}: {}".format(key, getattr(stats, key)))
for key, value in stats.items():
print("{}: {}".format(key, getattr(stats, key)))
break
finally:
stream.stop()
Expand Down
17 changes: 4 additions & 13 deletions src/spead2_recv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static void show_heap(const spead2::recv::heap &fheap, const options &opts)
{
std::cout
<< "Descriptor for " << descriptor.name
<< " (" << std::hex << descriptor.id << ")\n"
<< " (" << std::hex << descriptor.id << std::dec << ")\n"
<< " description: " << descriptor.description << '\n'
<< " format: [";
bool first = true;
Expand Down Expand Up @@ -168,7 +168,7 @@ static void show_heap(const spead2::recv::heap &fheap, const options &opts)
std::cout << std::hex << item.id << std::dec
<< " = [" << item.length << " bytes]";
if (item.is_immediate)
std::cout << " = " << std::hex << item.immediate_value;
std::cout << " = " << std::hex << item.immediate_value << std::dec;
std::cout << '\n';
}
std::cout << std::noshowbase;
Expand Down Expand Up @@ -391,16 +391,7 @@ int main(int argc, const char **argv)
}

std::cout << "Received " << n_complete << " heaps\n";
#define REPORT_STAT(field) (std::cout << #field ": " << stats.field << '\n')
REPORT_STAT(heaps);
REPORT_STAT(incomplete_heaps_evicted);
REPORT_STAT(incomplete_heaps_flushed);
REPORT_STAT(packets);
REPORT_STAT(batches);
REPORT_STAT(worker_blocked);
REPORT_STAT(max_batch);
REPORT_STAT(single_packet_heaps);
REPORT_STAT(search_dist);
#undef REPORT_STAT
for (const auto field : stats)
std::cout << field.first << ": " << field.second << '\n';
return 0;
}

0 comments on commit b7b40ae

Please sign in to comment.