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

📄 disksim_disk.h

📁 目前最精确的磁盘模拟器的第3版
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * DiskSim Storage Subsystem Simulation Environment (Version 3.0) * Revision Authors: John Bucy, Greg Ganger * Contributors: John Griffin, Jiri Schindler, Steve Schlosser * * Copyright (c) of Carnegie Mellon University, 2001, 2002, 2003. * * This software is being provided by the copyright holders under the * following license. By obtaining, using and/or copying this software, * you agree that you have read, understood, and will comply with the * following terms and conditions: * * Permission to reproduce, use, and prepare derivative works of this * software is granted provided the copyright and "No Warranty" statements * are included with all reproductions and derivative works and associated * documentation. This software may also be redistributed without charge * provided that the copyright and "No Warranty" statements are included * in all redistributions. * * NO WARRANTY. THIS SOFTWARE IS FURNISHED ON AN "AS IS" BASIS. * CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER * EXPRESSED OR IMPLIED AS TO THE MATTER INCLUDING, BUT NOT LIMITED * TO: WARRANTY OF FITNESS FOR PURPOSE OR MERCHANTABILITY, EXCLUSIVITY * OF RESULTS OR RESULTS OBTAINED FROM USE OF THIS SOFTWARE. CARNEGIE * MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND WITH RESPECT * TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * COPYRIGHT HOLDERS WILL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE * OR DOCUMENTATION. * *//* * DiskSim Storage Subsystem Simulation Environment (Version 2.0) * Revision Authors: Greg Ganger * Contributors: Ross Cohen, John Griffin, Steve Schlosser * * Copyright (c) of Carnegie Mellon University, 1999. * * Permission to reproduce, use, and prepare derivative works of * this software for internal use is granted provided the copyright * and "No Warranty" statements are included with all reproductions * and derivative works. This software may also be redistributed * without charge provided that the copyright and "No Warranty" * statements are included in all redistributions. * * NO WARRANTY. THIS SOFTWARE IS FURNISHED ON AN "AS IS" BASIS. * CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER * EXPRESSED OR IMPLIED AS TO THE MATTER INCLUDING, BUT NOT LIMITED * TO: WARRANTY OF FITNESS FOR PURPOSE OR MERCHANTABILITY, EXCLUSIVITY * OF RESULTS OR RESULTS OBTAINED FROM USE OF THIS SOFTWARE. CARNEGIE * MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND WITH RESPECT * TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. *//* * DiskSim Storage Subsystem Simulation Environment * Authors: Greg Ganger, Bruce Worthington, Yale Patt * * Copyright (C) 1993, 1995, 1997 The Regents of the University of Michigan  * * This software is being provided by the copyright holders under the * following license. By obtaining, using and/or copying this software, * you agree that you have read, understood, and will comply with the * following terms and conditions: * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose and without fee or royalty is * hereby granted, provided that the full text of this NOTICE appears on * ALL copies of the software and documentation or portions thereof, * including modifications, that you make. * * THIS SOFTWARE IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, * BUT NOT LIMITATION, COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR * WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR * THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY * THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT * HOLDERS WILL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE OR * DOCUMENTATION. * *  This software is provided AS IS, WITHOUT REPRESENTATION FROM THE * UNIVERSITY OF MICHIGAN AS TO ITS FITNESS FOR ANY PURPOSE, AND * WITHOUT WARRANTY BY THE UNIVERSITY OF MICHIGAN OF ANY KIND, EITHER * EXPRESSED OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE REGENTS * OF THE UNIVERSITY OF MICHIGAN SHALL NOT BE LIABLE FOR ANY DAMAGES, * INCLUDING SPECIAL , INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, * WITH RESPECT TO ANY CLAIM ARISING OUT OF OR IN CONNECTION WITH THE * USE OF OR IN CONNECTION WITH THE USE OF THE SOFTWARE, EVEN IF IT HAS * BEEN OR IS HEREAFTER ADVISED OF THE POSSIBILITY OF SUCH DAMAGES * * The names and trademarks of copyright holders or authors may NOT be * used in advertising or publicity pertaining to the software without * specific, written prior permission. Title to copyright in this software * and any associated documentation will at all times remain with copyright * holders. */#ifndef DISKSIM_DISK_H#define DISKSIM_DISK_H#include "disksim_stat.h"#include "disksim_ioqueue.h"#include "config.h"#include <diskmodel/dm.h>// Disk statestypedef enum {  DISK_IDLE                = 1,  DISK_TRANSFERING         = 2,  DISK_WAIT_FOR_CONTROLLER = 3} disk_state_t;// Disk buffer states (both internal and external) typedef enum {  BUFFER_EMPTY             = 1,  BUFFER_CLEAN             = 2,  BUFFER_DIRTY             = 3,  BUFFER_READING           = 4,  BUFFER_WRITING           = 5,  BUFFER_PREEMPT           = 6,  BUFFER_IDLE              = 7,  BUFFER_CONTACTING        = 8,  BUFFER_TRANSFERING       = 9} disk_buffer_state_t;// Disk buffer content match types typedef enum {  BUFFER_COLLISION         = -1,  BUFFER_NOMATCH	   = 0,  BUFFER_WHOLE	           = 1,     // read   BUFFER_PARTIAL	   = 2,     // read   BUFFER_PREPEND           = 3,     // write   BUFFER_APPEND            = 4     // write } disk_cache_hit_t;/* Extra disk buffer flag variable *//* *** MAKE SURE THIS DOESN"T CONFLICT WITH ANY FLAGS IN global.h *** */#define BUFFER_BACKGROUND	0x10000000/* Disk buffer continuous read types */typedef enum {  BUFFER_NO_READ_AHEAD		= 0,  BUFFER_READ_UNTIL_TRACK_END	= 1,  BUFFER_READ_UNTIL_CYL_END	= 2,  BUFFER_READ_UNTIL_SEG_END	= 3,  BUFFER_DEC_PREFETCH_SCHEME    = 4} disk_cont_read_t;/* Disk request flags */#define SEG_OWNED			0x00000001#define HDA_OWNED			0x00000002#define EXTRA_WRITE_DISCONNECT          0x00000004#define COMPLETION_SENT                 0x00000008#define COMPLETION_RECEIVED             0x00000010#define FINAL_WRITE_RECONNECTION_1      0x00000020#define FINAL_WRITE_RECONNECTION_2      0x00000040/* Disk preseeking levels */typedef enum {  NO_PRESEEK                     = 0,  PRESEEK_DURING_COMPLETION      = 1,  PRESEEK_BEFORE_COMPLETION      = 2        /* implies 1 as well */} disk_preseek_t;/* Disk fastwrites levels */typedef enum {  NO_FASTWRITE			= 0,  LIMITED_FASTWRITE		= 1,  FULL_FASTWRITE	        = 2} disk_fastwrite_t;/* aliases */#define ioreq_hold_disk tempptr1#define ioreq_hold_diskreq tempptr2/* free blocks added may change later */#define MAXSTATS 10#define MAXDISKS 100typedef struct seg {   double       time;   disk_buffer_state_t state;   struct seg  *next;   struct seg  *prev;   int          startblkno;   int          endblkno;   disk_buffer_state_t outstate;   int		outbcount;   int		minreadaheadblkno;      /* min prefetch blkno + 1 */   int		maxreadaheadblkno;      /* max prefetch blkno + 1 */   struct diskreq_t *diskreqlist;       /* sorted by ascendingly first blkno */   int          size;                                        /* diskreqlist normally starts					 * as a single request, more					 * can be added by read hits					 * on the segment and write					 * combining */   ioreq_event *access;                 /* copy of the active ioreq                                         * using this seg -rcohen */   int		hold_blkno; 		/* used for prepending */   int		hold_bcount;		/* sequential writes   */   struct diskreq_t *recyclereq;        /* diskreq to recycle this seg */} segment;typedef struct diskreq_t {   int			flags;   ioreq_event 	       *ioreqlist;	/* sorted by ascending blkno */   struct diskreq_t    *seg_next;	/* list attached to a segment */   struct diskreq_t    *bus_next;   int			outblkno;   int			inblkno;   segment	       *seg;		/* associated cache segment */   int          	watermark;   disk_cache_hit_t     hittype;	/* for cache use */   double		overhead_done;   char			space[20];} diskreq;typedef struct {   double  seektime;   double  latency;   double  xfertime;   int     seekdistance;   int     zeroseeks;   int     zerolatency;   int     highblkno;   statgen seekdiststats;   statgen seektimestats;   statgen rotlatstats;   statgen xfertimestats;   statgen postimestats;   statgen acctimestats;   int     writecombs;   int     readmisses;   int     writemisses;   int     fullreadhits;   int     appendhits;   int     prependhits;   int     readinghits;   double  runreadingsize;   double  remreadingsize;   int     parthits;   double  runpartsize;   double  rempartsize;   int     interfere[2];   double  requestedbus;   double  waitingforbus;   int     numbuswaits;} diskstat;// replaces currangle/currtime/... foostruct disk_currstate {  struct dm_mech_state s;  dm_time_t t;};typedef struct disk {  struct device_header hdr;  struct dm_disk_if    *model;  struct dm_mech_state mech_state;  int	               devno;  // if true, uses constant access-time model,  // bypasses some of mech model  int       const_acctime;   // constant access time; only meaningful if const_acctime is true  double          acctime;  // if true, uses constant seek-time model,  // bypasses some of mech model  int       const_seektime;  // constant seek time; only meaningful if const_seektime set  double          seektime;  // "Per-request overhead time"  double       overhead;  double       timescale;    // which syncset we're in; only really used to sync up disks in  // syncsets once at beginning of simulation  int          syncset;  // list of io's not completed   struct ioq  *queue;	         // "Avg" value used in suboptimal schedulers   int	       sectpercyl;      // controller stuff  int		hold_bus_for_whole_read_xfer;  int		hold_bus_for_whole_write_xfer;  // cache stuff  int		almostreadhits;  int		sneakyfullreadhits;  int		sneakypartialreadhits;  int		sneakyintermediatereadhits;  int		readhitsonwritedata;  int		writeprebuffering;  // diskctlr  int		preseeking;  // ctlr/cache  int		neverdisconnect;  // doesn't appear to be used  // int           qlen;  int           maxqlen;  int           busy;  // cache/controller   int		prev_readahead_min;  int		write_hit_stop_readahead;  int		read_direct_to_buffer;  int		immedtrans_any_readhit;  int		readanyfreeblocks;  int		numsegs;  int		numwritesegs;  segment *	dedicatedwriteseg;  int		segsize;  double	writewater;  double	readwater;

⌨️ 快捷键说明

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