From 0700cb28c8c52a9cc675db648adddcf822af8652 Mon Sep 17 00:00:00 2001 From: Monte Copeland Date: Thu, 5 Jan 2012 13:36:20 -0600 Subject: Perl fixes for variable-sized trace buffers. Change-Id: I40e5efaba9bde0a2b75b8cd5b316f7b8642db8bd Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/594 Tested-by: Jenkins Server Reviewed-by: Thi N. Tran Reviewed-by: Monte K. Copeland --- src/build/tools/hb-parsedump.pl | 14 ++++++++++++-- src/build/vpo/hb-virtdebug.pl | 27 +++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/build/tools/hb-parsedump.pl b/src/build/tools/hb-parsedump.pl index 9816eca8c..c190d3a2b 100755 --- a/src/build/tools/hb-parsedump.pl +++ b/src/build/tools/hb-parsedump.pl @@ -49,10 +49,12 @@ use File::Copy; #------------------------------------------------------------------------------ # Constants #------------------------------------------------------------------------------ -use constant MAX_NUM_TRACE_BUFFERS => 24; +use constant MAX_NUM_TRACE_BUFFERS => 48; use constant DESC_ARRAY_ENTRY_ADDR_SIZE => 8; use constant DESC_ARRAY_ENTRY_COMP_NAME_SIZE => 16; use constant TRAC_DEFAULT_BUFFER_SIZE => 0x0800; +use constant TRAC_BUFFER_SIZE_OFFSET => 20; +use constant TRAC_BUFFER_SIZE_SIZE => 4; #------------------------------------------------------------------------------ @@ -287,9 +289,17 @@ if ((0 != $addr) && (0 != $size)) #print "Component: $compName, $buffer, $compBufAddr\n"; $addr += DESC_ARRAY_ENTRY_ADDR_SIZE; + # read a portion of the buffer header to get its size + $buffer = readBinFile($hbDumpFile, + $compBufAddr+TRAC_BUFFER_SIZE_OFFSET, + TRAC_BUFFER_SIZE_SIZE); + my $compBufferSize = unpack('H*',$buffer); + $compBufferSize = hex $compBufferSize; + + #read the component trace buffer and save to file #read the component trace buffer - $buffer = readBinFile($hbDumpFile, $compBufAddr, TRAC_DEFAULT_BUFFER_SIZE); + $buffer = readBinFile($hbDumpFile, $compBufAddr, $compBufferSize ); chdir "$extDir"; diff --git a/src/build/vpo/hb-virtdebug.pl b/src/build/vpo/hb-virtdebug.pl index 5636f93b3..2a45ea6e1 100755 --- a/src/build/vpo/hb-virtdebug.pl +++ b/src/build/vpo/hb-virtdebug.pl @@ -42,11 +42,13 @@ use Cwd; #------------------------------------------------------------------------------ # Constants #------------------------------------------------------------------------------ -use constant MAX_NUM_TRACE_BUFFERS => 24; +use constant MAX_NUM_TRACE_BUFFERS => 48; use constant DESC_ARRAY_ENTRY_ADDR_SIZE => 8; use constant DESC_ARRAY_ENTRY_COMP_NAME_SIZE => 16; use constant TRAC_DEFAULT_BUFFER_SIZE => 0x0800; use constant CACHE_LINE_SIZE => 128; +use constant TRAC_BUFFER_SIZE_OFFSET => 20; +use constant TRAC_BUFFER_SIZE_SIZE => 4; #------------------------------------------------------------------------------ @@ -399,8 +401,29 @@ if ($dumpTrace) print "$command\n"; die if (system("$command") != 0); + # Get the length of the buffer from the component trace header + $buffer = readBinFile( "$outDir/trace.out", + $offset+TRAC_BUFFER_SIZE_OFFSET, + TRAC_BUFFER_SIZE_SIZE ); + + my $compBufferSize=unpack('H*',$buffer); + $compBufferSize = hex $compBufferSize; + + # Re-read trace buffer using correct buffer size + $offset = $compBufAddr % CACHE_LINE_SIZE; + $cacheLines = ceil( $compBufferSize / CACHE_LINE_SIZE); + if ($offset != 0) + { + $cacheLines += 1; + } + #print "$compName, addr $compBufAddr, offset $offset, cacheLines $cacheLines\n"; + $command = sprintf ("p8_dump_l3 %x $cacheLines -f $outDir/trace.out -b @ecmdOpt", + $compBufAddr); + print "$command\n"; + die if (system("$command") != 0); + #Extract just the component trace - $buffer = readBinFile("$outDir/trace.out", $offset, TRAC_DEFAULT_BUFFER_SIZE); + $buffer = readBinFile("$outDir/trace.out", $offset, $compBufferSize); #Append to tracBIN appendBinFile("$outDir/tracBIN", $buffer); -- cgit v1.2.1