⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 convert-parv.pl

📁 目前最精确的磁盘模拟器的第3版
💻 PL
📖 第 1 页 / 共 3 页
字号:
# GENERAL I/O SUBSYSTEM PARAMETERS#$line = shift(@lines); $linenum = shift(@linenums);if($line =~ /GENERAL I\/O SUBSYSTEM PARAMETERS/) {}else {    print STDERR "*** error on line $linenum: $line.\n";    exit(1);}# we build up a string of this and print it later;# it has to follow component instantiation because# iomaps refer to devices and this will fail to load# if the devices don't exist$iomaps = $iomaps . "iosim IS {\n";$line = shift(@lines); $linenum = shift(@linenums);if($line =~ /I\/O Trace Time Scale: (.*)/) {    $line =~ s/:/ =/;    $iomaps = $iomaps . "     $line";}else {    print STDERR "*** error on line $linenum: $line.\n";    exit(1);}$line = shift(@lines); $linenum = shift(@linenums);if($line =~ /Number of I\/O Mappings: ([0-9]+)/) {    $numiomaps = $1;}if($numiomaps) {    $iomaps = $iomaps . ",\n";    $iomaps = $iomaps . "     I/O Mappings = [ \n";    for($c = 0; $c < $numiomaps; $c++) {	$line = shift(@lines); $linenum = shift(@linenums);	print STDERR "IOMAP: $line\n";	if($c) { $iomaps = $iomaps . ",\n"; }	@m = split / /, $line;	shift @m;	# translate devno to devnames ?	# we're just going to say disk and if they wanted something else,	# they can fix it up.	$simdev = "disk" . hex($m[1]);	$iomaps = $iomaps . "     iomap { tracedev = 0x$m[0], simdev = $simdev, locScale = $m[2], sizeScale = $m[3], offset = $m[4] }";    }    $iomaps = $iomaps . "     ]  # end of iomap list\n";}else {    print "   # no iomaps\n";}$iomaps = $iomaps . "}  # end of iosim spec\n\n";## COMPONENT SPECIFICATIONS#$line = shift(@lines); $linenum = shift(@linenums);if($line =~ /COMPONENT SPECIFICATIONS/) {}else {    print STDERR "*** error on line $linenum: $line.\n";    exit(1);}## Device drivers#$line = shift(@lines); $linenum = shift(@linenums);if($line =~ /Number of device drivers: ([0-9]+)/) {    $numdrivers = $1;}else {    print STDERR "*** error on line $linenum: $line.\n";    exit(1);}for($c = 0; $c < $numdrivers; $c++) {    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /\Device Driver Spec #.*/)    {    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /\# drivers with Spec: ([0-9]+).*/)    {	if($1 > 1) {	    $maxdrv = $c + $1;	    $instances{"driver$c .. driver$maxdrv"} = "DRIVER$c";	}	else {	    $instances{"driver$c"} = "DRIVER$c";	}    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }        $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Device driver type.*/)    {	$line =~ s/Device driver type:/type =/;	print("disksim_iodriver DRIVER$c {\n  $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Constant access time.*/)    {	$line =~ s/:/ =/;	print("  $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }        $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Scheduling policy.*/)    {	$line =~ s/:/ =/;        print("  Scheduler = disksim_ioqueue {\n");	print("   $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }        $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Cylinder mapping strategy.*/)    {	$line =~ s/:/ =/;	print("   $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }        $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Write initiation delay.*/)        {	$line =~ s/:/ =/;	print("   $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }        $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Read initiation delay.*/)        {	$line =~ s/:/ =/;	print("   $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }        $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Sequential stream scheme.*/)        {	$line =~ s/:/ =/;	print("   $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }        $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Maximum concat size.*/)        {	$line =~ s/:/ =/;	print("   $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }        $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Overlapping request scheme.*/)        {	$line =~ s/:/ =/;	print("   $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }        $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Sequential stream diff maximum.*/)        {	$line =~ s/:/ =/;	print("   $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }        $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Scheduling timeout scheme.*/)        {	$line =~ s/:/ =/;	print("   $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }        $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Timeout time\/weight.*/)        {	$line =~ s/:/ =/;	print("   $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }        $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Timeout scheduling.*/)        {	$line =~ s/:/ =/;	print("   $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }        $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Scheduling priority scheme.*/)        {	$line =~ s/:/ =/;	print("   $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }        $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Priority scheduling.*/)        {	$line =~ s/:/ =/;	print("   $line\n  }, # end of Scheduler\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }        $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Use queueing in subsystem.*/)        {	$line =~ s/:/ =/;	print("  $line\n} # end of DRV$c spec\n\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }              }#### Buses##@buses = ();$line = shift(@lines); $linenum = shift(@linenums);if($line =~ /Number of buses: ([0-9]+)/) {    $numbuses = $1;}else {    print STDERR "*** error on line $linenum: $line.\n";    exit(1);}$specno = 0;for($c = 0; $c < $numbuses; $c++) {    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Bus Spec \#[0-9]+/)    {    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /\# buses with Spec: ([0-9]+)/)    {	$buswithspec = $1;	if($1 > 1) {	    $maxdrv = $c + $1 - 1;	    $instances{"bus$c .. bus$maxdrv"} = "BUS$specno";	}	else {	    $instances{"bus$c"} = "BUS$specno";	}	for($d = 0; $d < $1; $d++) {	    $num = $c + $d;	    push(@buses, "bus$num");	}    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    print("disksim_bus BUS$specno {\n");    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Bus Type.*/)        {	$line =~ s/Bus Type:/type =/;	print("  $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Arbitration type:*/)        {	$line =~ s/:/ =/;	print("  $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Arbitration time:.*/)        {	$line =~ s/:/ =/;	print("  $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Read block transfer time.*/)        {	$line =~ s/:/ =/;	print("  $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Write block transfer time:.*/)        {	$line =~ s/:/ =/;	print("  $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Print stats.*/)        {	print("  $line\n} # end of BUS$specno spec\n\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    if($buswithspec > 1) {	$c += ($buswithspec - 1);    }    $specno++;}#### Controllers##$line = shift(@lines); $linenum = shift(@linenums);if($line =~ /Number of controllers: ([0-9]+)/) {    $numctlrs = $1;}else {    print STDERR "*** error on line $linenum: $line\n";    exit(1);}# build an array mapping numbers to names @controllers = ();$specno = 0;for($c = 0; $c < $numctlrs; $c++) {    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Controller Spec \#[0-9]+/)    {    }    else {	print STDERR "*** error on line $linenum: $line\n";	exit(1);    }    print("disksim_ctlr CTLR$specno {\n");    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /\# controllers with Spec: ([0-9]+)/)    {	if($1 > 1) {	    $ctlrswithspec = $1;	    $maxdrv = $c + $1 - 1;	    $instances{"ctlr$c .. ctlr$maxdrv"} = "CTLR$specno";	}	else {	    $instances{"ctlr$c"} = "CTLR$c";	}	for($d = 0; $d < $1; $d++) {	    $num = $c + $d;	    push(@controllers, "CTLR$num");	}    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Controller Type:*/)        {	$line =~ s/Controller Type:/type =/;	print("  $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Scale for delays:*/)        {	$line =~ s/:/ =/;	print("  $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Bulk sector transfer time:*/)        {	$line =~ s/:/ =/;	print("  $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Maximum queue length:*/)        {	$line =~ s/:/ =/;	print("  $line,\n");    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Print stats.*/)        {	print "  $line";    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }        # deal with the ioqueue    for $d (0 .. 12) {	# for prev. param	if($d) { print ",\n"; }	$line = shift(@lines); $linenum = shift(@linenums);	if(!$d && !($line =~ /Scheduling policy.*/)) { 	    unshift(@lines, $line); 	    unshift(@linenums, $linenum);	    last;	}	elsif(!$d) {	    print ",\n";	    print "  Scheduler = disksim_ioqueue {\n";	}	$line =~ s/:/ =/;	print("    $line");	if($d == 12) { print "\n    # end of ioqueue spec\n  }"; }    }    # deal with the cache    $params = 1;    for ($d = 0; $d <= $params; $d++) {	if($d > 1) { print ",\n"; }	$line = shift(@lines); $linenum = shift(@linenums);	if(!$d && !($line =~ /Cache type: (.*)/)) { 	    unshift(@lines, $line); 	    unshift(@linenums, $linenum);	    last;	}	elsif(!$d) {	    if($1 == 2) {		$cachetype = "disksim_cachedev"; 		$params = 8;	    } else { $cachetype = "disksim_cachemem"; $params = 18; }	    print ",\n  Cache = $cachetype { \n";	}	else {	    $line =~ s/:/ =/;	    # cachemem	    $line =~ s/Cache prefetch type \(read\)/Read prefetch type/;	    $line =~ s/Cache prefetch type \(write\)/Write prefetch type/;	    $line =~ s/Cache scatter\/gather max/Max gather/;	    $line =~ s/Cache segment count \(SLRU\)/# SLRU segments/;	    $line =~ s/Cache blocks per bit/Bit granularity/;	    $line =~ s/Cache lock granularity/Lock granularity/;	    # cachedev	    if($line =~ /Cache device number = (.*)/) {		$line = "Cache device = $devtypes[$1]$1"; 	    }	    elsif($line =~ /Cache data for device = (.*)/) {		$line = "Cached device = $devtypes[$1]$1";	    }	    $line =~ s/\(.*\)//;	    if(!($line =~ /Cache size/) &&	       !($line =~ /Cache device/)) {		# yuck! there has to be an easier way to do this!		if($line =~ /(Cache )([^\s])(.*)=(.*)/) {		    $letter = $2;		    $letter =~ tr/a-z/A-Z/;		    $line = $letter . $3 . " = " . $4;		}	    }	    else {		$line =~ s/\(.*\)//;	    }	    print("    $line");	    if($d == $params) { 		print "\n    # end of $cachetype spec\n  }"; 		$line = shift(@lines); $linenum = shift(@linenums);		if($line =~ "Max per-disk pending.*") {		    $line =~ s/:/ =/;		    print(",\n  $line\n");		}	    }	}    }    print "} # end of CTLR$specno spec\n\n";    if($ctlrswithspec > 1) {	$c += ($ctlrswithspec - 1);    }    $specno++;}#### Devices##$line = shift(@lines); $linenum = shift(@linenums);if($line =~ /Number of storage devices: ([0-9]+)/) {    $numdevs = $1;}else {    print STDERR "*** error on line $linenum: $line.\n";    exit(1);}@devices = ();for($c = 0; $c < $numdevs; $c++) {    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Device Spec #.*/)    {    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /# devices with Spec: ([0-9]+)/)    {	$numSDs = $1;	$devswithspec = $numSDs;    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }    $line = shift(@lines); $linenum = shift(@linenums);    if($line =~ /Device type for Spec: (.*)/)    {	$devtype = $1;	$devtype =~ s/simpledisk/sd/;    }    else {	print STDERR "*** error on line $linenum: $line.\n";	exit(1);    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -