使用 SPIM 测量执行时间

发布于 2024-12-28 20:34:54 字数 55 浏览 2 评论 0原文

我需要测量用汇编语言编写的河内塔程序的执行时间。是否有任何函数或特定寄存器值用于执行此任务..?

I need to measure execution time of Hanoi Towers program, written in assembly language. Is there any function or specific register value used to do this task..?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

遇见了你 2025-01-04 20:34:54

我不太了解 SPIM,但任何 mips 处理器都有一个计数寄存器,它以 CPU 时钟的一半递增。如果 SPIM 模拟该寄存器,您可以轻松测量程序执行时间。只需在程序执行之前和之后读取其内容即可。

如果 SPIM 不模拟该寄存器或对指令进行计数,则 MARS mips 模拟器会模拟该寄存器或计数指令。一般来说,在模拟器中测量时间是没有意义的,因为根据主机硬件的不同,同一程序的时间会有所不同。指令计数器是更好的性能衡量标准,因为它与仿真器主机无关。

MARS 有一个指令计数器,我认为它可以运行 SPIM 程序。

经过短暂的搜索,我发现了这个:
http://www.cs.colostate.edu/~mstrout/spim/keepstats .html

修改了对指令进行计数的 SPIM。

I don't know specifically about SPIM but any mips processor has a Count register which increments at half CPU clock. If SPIM emulates this register you can easy measure program execution time. Just read its content before and after program was executed.

If SPIM does not emulate this register or counts instructions, MARS mips emulator does. In general measuring time in emulator is pointless since depending on the host hardware time would be different for the same program. Instruction counter is a better measure of performance since it would be the same independent of emulator host.

MARS has an instruction counter and I think it would run SPIM program.

After a short search I found this:
http://www.cs.colostate.edu/~mstrout/spim/keepstats.html

Modified SPIM that counts instructions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文