CS计算机代考程序代写 compiler b’ProfilingDemo.tar.gz’

b’ProfilingDemo.tar.gz’

# to compile manually:
gcc -Wall -pg test_gprof.c test_gprof_new.c -o test_gprof

# Then run the application
./test_gprof

# Then convert gmon.out to something readable.
gprof test_gprof gmon.out > analysis.txt

# This is a comment in a make file

# Set the variable CC to the compiler of choice i
# (gcc for c code, g++ for cpp code)
CC=gcc

# Insert compiler flags here (-pg is used for gprof)
CFLAGS= -pg

DEPS =

# list out the object files (In this case, two files)
OBJ = test_gprof.o test_gprof_new.o

# Nifty line to compile the source code into object code
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS) # Rule to make the executable (link the object code) test_gprof: $(OBJ) $(CC) -o $@ $^ $(CFLAGS) # cleanup rule (make clean) .PHONY: clean clean: rm -f $(OBJ) test_gprof /** * Filename: test_gprof.c * * Demo file for learning how to use gprof. * * From https://www.thegeekstuff.com/2012/08/gprof-tutorial/ **/ #include

void new_func1(void);

void func1(void)
{
printf(“\n Inside func1 \n”);
int i = 0;

for(;i<0xffffffff;i++); new_func1(); return; } static void func2(void) { printf("\n Inside func2 \n"); int i = 0; for(;i<0xffffffaa;i++); return; } int main(void) { printf("\n Inside main()\n"); int i = 0; for(;i<0xffffff;i++); func1(); func2(); return 0; } //test_gprof_new.c #include

void new_func1(void)
{
printf(“\n Inside new_func1()\n”);
int i = 0;

for(;i<0xffffffee;i++); return; } Readme.txt Makefile test_gprof.c test_gprof_new.c