count_user_insts.tcl

来自「一个用在mips体系结构中的操作系统」· TCL 代码 · 共 60 行

TCL
60
字号
## 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. ####### count_user_insts.tcl###### $Author: bosch $### $Date: 1998/02/10 00:26:17 $######### Cool way to count and print out how many user instructions go### to each user process. This prints them periodically and at the### end of the run.###for {set i 0} {$i < 16400} {incr i} {    set countStartInstsPid($i)  0    set countTotalPidInsts($i)  0}annotation set osEvent startUser {    set pid $currentPid($CPU)    if {$pid >= $IDLE_PID} {        console "COUNT: START USER is idle $pid\n"    }    set countStartInstsPid($pid) $INSTS}#    log "COUNT: Starting $pid at $CYCLES and $INSTS insts\n"annotation set osEvent endUser {    set pid $currentPid($CPU)    if {$pid >= $IDLE_PID} {        console "COUNT: END USER is idle $pid\n"    }    set countInstsRun [expr $INSTS - $countStartInstsPid($pid)]    set countTotalPidInsts($pid) [expr $countTotalPidInsts($pid) + $countInstsRun]}#    log "COUNT: Ending $pid at $CYCLES and $INSTS => $countInstsRun\n"annotation set simos exit {    for {set i 0} {$i < $IDLE_PID} {incr i} {        if {$countTotalPidInsts($i) != 0} {            log "COUNT: Pid $i => $countTotalPidInsts($i)\n"        }    }}annotation set simos periodic {    for {set i 0} {$i < $IDLE_PID} {incr i} {        if {$countTotalPidInsts($i) != 0} {            log "COUNT: Pid $i => $countTotalPidInsts($i)\n"        }    }}

⌨️ 快捷键说明

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