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

📄 printtree

📁 一个用在mips体系结构中的操作系统
💻
字号:
#!/usr/local/bin/perl5 -w## Copyright (C) 1996-1998 by the Board of Trustees#    of Leland Stanford Junior University.# # This file is part of the SimOS distribution. # See LICENSE file for terms of the license. ## if (defined($ENV{'SIMTOOLS'})) {     unshift(@INC,"$ENV{'SIMTOOLS'}/apps/scripts");}require "tree.prl";$inputFile  = "cpu.log";$startNode  = "ROOT";$targetTree = "modes";    $i=0;while ($i<=$#ARGV) {    if ($ARGV[$i] eq "-f") {        $i++;        $inputFile = $ARGV[$i++];            } elsif ($ARGV[$i] eq "-s") {        $i++;        $startNode = $ARGV[$i++];            } elsif ($ARGV[$i] eq "-t") {        $i++;        $targetTree = $ARGV[$i++];            } else {        print "usage: printTree [-f file] [-s node] [-t tree]\n";        exit;    }}$tree  = ParseTree($inputFile, $targetTree);$total = TotalTree($tree, $startNode);printTree($tree);sub printTree {    ($tree) = @_;    foreach $state (keys %$tree) {        ComputeDerivedFields($tree->{$state});    }    printHeader();    foreach $state (sort bycomp (keys %$tree)) {        printService($tree->{$state});    }}sub printHeader {        printf("%s %42s %6s %7s %10s\n",                "Name", "%Total", "%Kern", "Count", "Avg.Lat");        printf("----------------------------------------------");        printf("---------------------------\n");}sub printService {    my($bucket) = @_;    my($service) = PhaseName($bucket->{"name"});    if ($service eq "DESCHED") {        return;    }        if ($bucket->{'n'}) {        $avg = $bucket->{'_cycles'}/$bucket->{'n'};    } else {        $avg = 0;    }    if ($total->{'_cycles'} != 0) {        printf "%-40s %5.1f%% %5.1f%% %7d %10.2f\n",         $bucket->{"name"},         100.0*$bucket->{'_cycles'}/($total->{'_cycles'}),        100.0*$bucket->{'_cycles'}/($total->{'_cycles'}-$tree->{'ROOT'}{'_cycles'}),        $bucket->{'n'}, $avg;    } else {        printf "%-40s NO TIME\n", $bucket->{"name"};    }}sub bycomp {    $tree->{$b}{'_cycles'} <=> $tree->{$a}{'_cycles'};}

⌨️ 快捷键说明

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