Added some new metric scripts and Trace analysys tools
This commit is contained in:
64
dram/resources/scripts/address_scrambler.pl
Normal file
64
dram/resources/scripts/address_scrambler.pl
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/perl
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
my $filename = shift || die;
|
||||
|
||||
open(FH, "$filename");
|
||||
|
||||
while(<FH>)
|
||||
{
|
||||
# Get all the data adress:
|
||||
$_ =~ /(\d+):\s+(\w+)\s+0x([\w\d]+)/;
|
||||
my $time = $1;
|
||||
my $command = $2;
|
||||
my $address = $3;
|
||||
my $new_address;
|
||||
|
||||
# Convert to binary:
|
||||
$address = sprintf( "%032b", hex( $address ) );
|
||||
|
||||
# example:
|
||||
# 31 0
|
||||
# 00000000000000000000000000000001
|
||||
# 00000000000000000000010000000000
|
||||
|
||||
# Swap adresses:
|
||||
$new_address = substr($address,31 - 31,1). # R 31
|
||||
substr($address,31 - 30,1). # R 30
|
||||
substr($address,31 - 29,1). # R 29
|
||||
substr($address,31 - 28,1). # R 28
|
||||
substr($address,31 - 27,1). # R 27
|
||||
substr($address,31 - 26,1). # R 26
|
||||
substr($address,31 - 25,1). # R 25
|
||||
substr($address,31 - 24,1). # R 24
|
||||
substr($address,31 - 23,1). # R 23
|
||||
substr($address,31 - 22,1). # R 22
|
||||
substr($address,31 - 21,1). # R 21
|
||||
substr($address,31 - 20,1). # R 20
|
||||
substr($address,31 - 19,1). # R 19
|
||||
substr($address,31 - 18,1). # R 18
|
||||
substr($address,31 - 17,1). # R 17
|
||||
substr($address,31 - 16,1). # R 16
|
||||
substr($address,31 - 8,1). # R 15
|
||||
substr($address,31 - 7,1). # R 14
|
||||
substr($address,31 - 6,1). # R 13
|
||||
substr($address,31 - 11,1). # B 12
|
||||
substr($address,31 - 9,1). # B 11
|
||||
substr($address,31 - 0,1). # B 10
|
||||
substr($address,31 - 15,1). # C 9
|
||||
substr($address,31 - 14,1). # C 8
|
||||
substr($address,31 - 13,1). # C 7
|
||||
substr($address,31 - 12,1). # C 6
|
||||
substr($address,31 - 10,1). # C 5
|
||||
substr($address,31 - 5,1). # C 4
|
||||
substr($address,31 - 4,1). # C 3
|
||||
substr($address,31 - 3,1). # C 2
|
||||
substr($address,31 - 2,1). # C 1
|
||||
substr($address,31 - 1,1); # C 0
|
||||
|
||||
$new_address = sprintf("%X", oct( "0b$new_address" ) );
|
||||
|
||||
print $time.":\t".$command."\t0x".$new_address."\n";
|
||||
}
|
||||
|
||||
44
dram/resources/scripts/analyse_trace.pl
Normal file
44
dram/resources/scripts/analyse_trace.pl
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/perl
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
my $filename = shift || die;
|
||||
|
||||
open(FH, "$filename");
|
||||
|
||||
my @activity_counter;
|
||||
|
||||
for(my $i = 0; $i < 32; $i++)
|
||||
{
|
||||
$activity_counter[$i] = 0;
|
||||
}
|
||||
|
||||
my $old_address = "00000000000000000000000000000000";
|
||||
|
||||
while(<FH>)
|
||||
{
|
||||
# Get the adress:
|
||||
$_ =~ /\d+:\s+\w+\s+0x([\w\d]+)/;
|
||||
my $address = $1;
|
||||
$address = sprintf( "%032b", hex( $address ) );
|
||||
|
||||
# $i = 0 :: most significant bit
|
||||
for(my $i = 0; $i < 32; $i++)
|
||||
{
|
||||
my $new = substr($address, $i, 1);
|
||||
my $old = substr($old_address, $i, 1);
|
||||
|
||||
if($new ne $old)
|
||||
{
|
||||
$activity_counter[31-$i]++;
|
||||
}
|
||||
}
|
||||
|
||||
$old_address = $address;
|
||||
}
|
||||
|
||||
for(my $i = 0; $i < 32; $i++)
|
||||
{
|
||||
print $i.":".$activity_counter[$i]."\n";
|
||||
}
|
||||
|
||||
@@ -50,15 +50,38 @@ def getClock(connection):
|
||||
# plt.savefig('hist.png')
|
||||
# return "Saved as hist.png"
|
||||
|
||||
#@metric
|
||||
#def average_response_latency_in_ns(connection):
|
||||
# cursor = connection.cursor()
|
||||
# cursor.execute("""SELECT avg(PhaseBegin-timeOfGeneration)/1000 FROM transactions INNER JOIN Phases
|
||||
# ON phases.transact = transactions.ID WHERE PhaseName='RESP' """)
|
||||
#
|
||||
# result = cursor.fetchone()
|
||||
# return round(result[0],1)
|
||||
|
||||
@metric
|
||||
def trace_length_in_ns(connection):
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(""" SELECT max(PhaseEnd)/1000 FROM PHASES; """)
|
||||
result = cursor.fetchone()
|
||||
return result[0]
|
||||
|
||||
@metric
|
||||
def average_response_latency_in_ns(connection):
|
||||
cursor = connection.cursor()
|
||||
cursor.execute("""SELECT avg(PhaseBegin-timeOfGeneration)/1000 FROM transactions INNER JOIN Phases
|
||||
ON phases.transact = transactions.ID WHERE PhaseName='RESP' """)
|
||||
cursor.execute("""SELECT AVG(RESP.PHASEBEGIN - REQ.PHASEBEGIN)/1000 FROM PHASES REQ, PHASES RESP WHERE REQ.PHASENAME = 'REQ' AND RESP.PHASENAME='RESP' AND REQ.TRANSACT = RESP.TRANSACT """)
|
||||
|
||||
result = cursor.fetchone()
|
||||
return round(result[0],1)
|
||||
|
||||
@metric
|
||||
def trans_with_max_response_latency(connection):
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(""" SELECT REQ.TRANSACT, max(RESP.PHASEBEGIN - REQ.PHASEBEGIN)/1000 FROM PHASES REQ, PHASES RESP WHERE REQ.PHASENAME = 'REQ' AND RESP.PHASENAME='RESP' AND REQ.TRANSACT = RESP.TRANSACT """)
|
||||
|
||||
result = cursor.fetchone()
|
||||
return result[0]
|
||||
|
||||
@metric
|
||||
def memory_utilisation_percent(connection):
|
||||
cursor = connection.cursor()
|
||||
|
||||
Reference in New Issue
Block a user