Topic: [请教]数据结构问题

  Print this page

1.[请教]数据结构问题 Copy to clipboard
Posted by: mitnickcbc
Posted on: 2002-12-25 16:17

Write a program that determines the values of the timing
parameters of the detailed model(读数据时间,存数据时间,
加法运算时间,等等)for the machine on which it is run.

2.Re:[请教]数据结构问题 [Re: mitnickcbc] Copy to clipboard
Posted by: taogang
Posted on: 2002-12-25 17:47

To put a system timestamp at beginning and end of your funcitons, then you should get milliseconds your functions spent, however, the results will be based on your hardware settings.

If there are any packages can do such benchmark stuff in more sophisticated way and easier than optimizeit?

3.不明白 [Re: mitnickcbc] Copy to clipboard
Posted by: snowbug
Posted on: 2002-12-26 22:54

mitnickcbc wrote:
Write a program that determines the values of the timing
parameters of the detailed model(读数据时间,存数据时间,
加法运算时间,等等)for the machine on which it is run.


why is it a "数据结构问题"?

4.Re:[请教]数据结构问题 [Re: mitnickcbc] Copy to clipboard
Posted by: mitnickcbc
Posted on: 2002-12-26 23:59

是数据结构书上的练习题,讲时间复杂度,
如果设timestamp,但timestamp本身运行也要时间阿,
如果我只要求一次加法的时间,怎么做?

5.Re:[请教]数据结构问题 [Re: mitnickcbc] Copy to clipboard
Posted by: floweret
Posted on: 2002-12-27 08:47

你连续3次打印时间,第一次和第三次的时间差就是打印时间所花的时间。 不知道这样可以不 Tongue

6.Re:[请教]数据结构问题 [Re: floweret] Copy to clipboard
Posted by: mitnickcbc
Posted on: 2002-12-27 13:43

floweret wrote:
你连续3次打印时间,第一次和第三次的时间差就是打印时间所花的时间。 不知道这样可以不 Tongue


方法不错,但好像不对吧,我觉得两次连续打印就行了,
time2 - time1 就是一次打印的时间。

7.Re:[请教]数据结构问题 [Re: mitnickcbc] Copy to clipboard
Posted by: taogang
Posted on: 2002-12-27 16:27

try this:

step 1: put two timestamps at beginning and end of your functions

step 2: comment out the codes you want to evaluate, run and record the milliseconds

step 3: put back the codes you just commented out, run and record the milliseconds again

see the increment of step 3 from step 2

8.Re:[请教]数据结构问题 [Re: mitnickcbc] Copy to clipboard
Posted by: mitnickcbc
Posted on: 2002-12-27 16:31

谢谢

9.Re:[请教]数据结构问题 [Re: mitnickcbc] Copy to clipboard
Posted by: taogang
Posted on: 2002-12-27 17:01

however I am afraid you might not see any increment at all if you just want to get the time spent on an "add", because a lot of this can be done in just one millisecond on even very "poor" machines.


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923