flashsim源码阅读7-8(2)

本文详细分析了disksim源码中的event处理,特别是对NULL_EVENT类型的特殊处理。在disksim.c中,当event类型为NULL_EVENT时,可能表示bus channel空闲。文章探讨了如何根据disksim结构体变量和函数判断外部负载状态,并解释了相关宏定义的作用。此外,还介绍了如何从intq队列中取出event并进行类型转换,以及在外部负载不为空时的处理流程。最后提到了ioreq_event结构体和其在处理I/O请求中的角色。
摘要由CSDN通过智能技术生成

再次回到disksim_simulate_event()函数主体:

void disksim_simulate_event (int num)
{
  event *curr;

  if ((curr = getnextevent()) == NULL) {
    disksim_simstop ();
  } 
  else {

    switch(disksim->trace_mode) {
    case DISKSIM_NONE:
    case DISKSIM_MASTER:
//      fprintf(outputfile, "*** DEBUG TRACE\t%f\t%d\t%d\n",   
//        simtime, curr->type, num);   
  //    fflush(outputfile);    
      break;

    case DISKSIM_SLAVE:
      break;
    }

    simtime = curr->time;

    if (curr->type == INTR_EVENT) {
      intr_acknowledge (curr);
    } 
    else if ((curr->type >= IO_MIN_EVENT) && (curr->type <= IO_MAX_EVENT)) {
      io_internal_event ((ioreq_event *)curr);
    } 
    else if ((curr->type >= PF_MIN_EVENT) && (curr->type <= PF_MAX_EVENT)) {
      pf_internal_event(curr);
    }
    else if (curr->type == TIMER_EXPIRED) {
      timer_event *timeout = (timer_event *) curr;
      (*timeout->func) (timeout);
    } 
    else if ((curr->type >= MEMS_MIN_EVENT) 
         && (curr->type <= MEMS_MAX_EVENT)) {
      io_internal_event ((ioreq_event *)curr);
    } 
    else if (curr->type == CHECKPOINT) {
      if (d
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值