citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit 2b15be0d5f2544a4105e7e0ef62d40a85c02ae7d
parent ae77b59d403184aef5f813072071df3e512bf04f
Author: Kyle Milz <kyle@0x30.net>
Date:   Fri, 29 Jul 2016 22:18:36 -0600

Test: combine some reads

Diffstat:
MTest/Viewer.pm | 14++++----------
1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/Test/Viewer.pm b/Test/Viewer.pm @@ -57,20 +57,14 @@ sub accept { # Read the static translation unit information. my @tus; for (1..$self->{num_tus}) { - # Size of absolute file path. + # Absolute file path. $buf = read_all($client, 2); my $file_name_sz = unpack("S", $buf); - - # Absolute file path. my $file_name = read_all($client, $file_name_sz); - # Total number of lines in primary source file. - $buf = read_all($client, 4); - my $num_lines = unpack("L", $buf); - - # Number of instrumentation sites in primary source file. - $buf = read_all($client, 4); - my $inst_sites = unpack("L", $buf); + # Total number of lines and number of instrumented sites. + $buf = read_all($client, 4 + 4); + my ($num_lines, $inst_sites) = unpack("L2", $buf); # Keep this in order so it's easy to fetch dynamic data. push @tus, [ $file_name, $num_lines, $inst_sites ];