深入理解计算机系统源代码,深入理解计算机系统Cache实验源代码

Number of block offset bits.\n");

printf("  -t Trace file.\n");

printf("\nExamples:\n");

printf("  linux>  %s -s 4 -E 1 -b 4 -t traces/yi.trace\n", argv[0]);

printf("  linux>  %s -v -s 8 -E 2 -b 4 -t traces/yi.trace\n", argv[0]);

exit(0);

}

/*

* main - Main routine

*/

int main(int argc, char* argv[])

{

char c;

while( (c=getopt(argc,argv,"s:E:b:t:vh")) != -1)

{

switch(c)

{

case 's':

s = atoi(optarg);

break;

case 'E':

E = atoi(optarg);

break;

case 'b':

b = atoi(optarg);

break;

case 't':

trace_file = optarg;

break;

case 'v':

verbosity = 1;

break;

case 'h':

printUsage(argv);

exit(0);

default:

printUsage(argv);

exit(1);

}

}

/* Make sure that all required command line args were specified */

if (s == 0 || E == 0 || b == 0 || trace_file == NULL)

{

printf("%s: Missing required command line argument\n", argv[0]);

printUsage(argv);

exit(1);

}

/* Compute S, E and B from command line args */

S = pow(2,s);

/* Initialize cache */

initCache();

#ifdef DEBUG_ON

printf("DEBUG: S:%u E:%u B:%u trace:%s\n", S, E, B, trace_file);

printf("DEBUG: set_index_mask: %llu\n", set_index_mask);

#endif

replayTrace(trace_file);

/* Free allocated memory */

freeCache();

/* Output the hit and miss statistics for the autograder */

printSummary(hit_count, miss_count, eviction_count);

return 0;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值