As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/
Options

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

  • Options
    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
  • Options
    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
  • Options
    EchoEcho ski-bap ba-dapModerator mod
    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
  • Options
    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
  • Options
    EchoEcho ski-bap ba-dapModerator mod
    edited July 2009
    Might be included in Cygwin.

    Echo on
  • Options
    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.