Week 4 - 120 lab --------------------------------- - a few more things about makefiles: to specify gcc as the compiler (not cc): CFLAGS= -ansi -std=c99 -pedantic -Wall -Wextra -O -g CC=gcc - more on gdb - practice with linked lists: Here are the list files we were created in class this week. Makelist list.h list.c listDriver.c You can download them onto your unix account easily with the command "wget": >wget http://www.cs.jhu.edu/~joanne/cs120/code/Makelist Download all of those (use exact filename URLs), as well as the myRand.h and myRand.c files. Write and test these other list functions: addTail sort (bubble sort is probably easiest) size A mergesort function for a list would also be very interesting because it's easier to merge (no extra memory) than with an array. However, this probably works best with a double linked list. So maybe creating a doubly linked list is a good exercise as well... > memusage --help Usage: memusage [OPTION]... PROGRAM [PROGRAMOPTION]... Profile memory usage of PROGRAM. -n,--progname=NAME Name of the program file to profile -p,--png=FILE Generate PNG graphic and store it in FILE -d,--data=FILE Generate binary data file and store it in FILE -u,--unbuffered Don't buffer output -b,--buffer=SIZE Collect SIZE entries before writing them out --no-timer Don't collect additional information through timer -m,--mmap Also trace mmap & friends -?,--help Print this help and exit --usage Give a short usage message -V,--version Print version information and exit The following options only apply when generating graphical output: -t,--time-based Make graph linear in time -T,--total Also draw graph of total memory use --title=STRING Use STRING as title of the graph -x,--x-size=SIZE Make graphic SIZE pixels wide -y,--y-size=SIZE Make graphic SIZE pixels high Other ways of tracking memory on a Linux system: free, vmstat, "cat /proc/meminfo" You can call these from within a C program, using the "system" function