Thread: measuring system resources used by a function

  1. #1
    Registered User Aran's Avatar
    Join Date
    Aug 2001

    measuring system resources used by a function

    I'm currently working on a project for my "Theory of Programming Languages" class. It requires us to write 2 programs, one to test a math function's speed and "system resources used" in Java, and one in C (using the same math function). I can do the timing part in C and Java fine, but i have no idea how to measure the system resources used by a function in either language. I'm particularly clueless about doing it in C, because i don't really know C very well. I have a reasonable understanding of C++... that's as close as I've gotten to C.

    Does anyone have an idea of what I should do to measure the system resources used by a function? Google searches haven't turned up any relevant results from which i could garner any useful information. The project is due a week from wednesday. I've tried asking the professor what he means, but he is, simply put, a poor teacher--he just repeats "you have to measure system resources" without adding anything and or clarifying anything. My classmates seem to be as in the dark as I am.

    Any help would be greatly appreciated.

    I'm NOT asking to have code written for me. I just want people with more experience with programing than myself to interpret this assignment and perhaps clarify what i should do, point me to a relevant tutorial, or give me some tips.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Does anyone have an idea of what I should do to measure the system resources used by a function?
    Like how much time it uses? Use a profiler, like gprof. Or time to time your whole program (under Linux). Or a Win32 function that does the same thing (I can give you the source for this if you want it).

    As for "resources", if you mean memory, try a memory management package or something. [edit] Might help: [/edit]

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell

    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ:

    My website:
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Replies: 2
    Last Post: 03-05-2009, 09:25 AM
  3. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  4. Change this program so it uses function??
    By stormfront in forum C Programming
    Replies: 8
    Last Post: 11-01-2005, 07:55 AM
  5. I need help with passing pointers in function calls
    By vien_mti in forum C Programming
    Replies: 3
    Last Post: 04-24-2002, 10:00 AM
Website Security Test