The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

Compare Performance of Two Programs

jclastjclast Registered User regular
edited July 2009 in Help / Advice Forum
So I'm taking an algorithms class, and part of this week's assignment is to compare the performance of 2 algorithms. I already implemented both of them (Kruskal's and Prim's algorithm for generating a minimum spanning tree), but I have no idea how to convince the cmd prompt to tell me how many processor cycles each program takes when against my sample input.

Any ideas?

Thanks.

camo_sig2.png
jclast on

Posts

  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited July 2009
    I think if you've got Vista there are some advanced system resources tools that you might be able to look at. I know there's super detailed stuff about memory and hard disk access on a process-by-process basis.

    Jasconius on
    this is a discord of mostly PA people interested in fighting games: https://discord.gg/DZWa97d5rz

    we also talk about other random shit and clown upon each other
  • jclastjclast Registered User regular
    edited July 2009
    I'm on XP. When I programmed on Unix in college there was something I could throw at the front of the program from the command line that would tell me how many cycles it took. I'm not sure what else the prof would want me to do here.

    jclast on
    camo_sig2.png
  • EchoEcho ski-bap ba-dapModerator, Administrator admin
    edited July 2009
    Which OS? Unix typically has "time" - though it's probably not exact enough for you if you want exact number of cycles.
    time uptime
     4:54  up 7 days,  7:18, 2 users, load averages: 0,36 0,40 0,35
    
    real    0m0.005s
    user    0m0.001s
    sys     0m0.004s
    

    Echo on
  • jclastjclast Registered User regular
    edited July 2009
    Echo wrote: »
    Which OS? Unix typically has "time" - though it's probably not exact enough for you if you want exact number of cycles.
    time uptime
     4:54  up 7 days,  7:18, 2 users, load averages: 0,36 0,40 0,35
    
    real    0m0.005s
    user    0m0.001s
    sys     0m0.004s
    

    That's what I used in college. Is there a comparable function in WinXP (SP3 in case it matters)?

    jclast on
    camo_sig2.png
  • EchoEcho ski-bap ba-dapModerator, Administrator admin
    edited July 2009
    Might be included in Cygwin.

    Echo on
  • jclastjclast Registered User regular
    edited July 2009
    Never mind. I just threw some basic timing in the program itself. Apparently C# will measure in "ticks" (whatever those are), and I can just compare those together. Should be close enough to see which algorithm is more efficient at any rate.

    Feel free to lock this up, and thanks for help.

    jclast on
    camo_sig2.png
Sign In or Register to comment.