# TAWK Program Profiler # Part 2 of 2 (Display Utility) # Copyright (C) 1996 QUERE Jean-Marc # Email: quere@worldnet.fr # # I give you ( THOMPSON ) the autorization to post this sources as is # in your WebSite and registred users of TAWK to use them as they want. # Don't remove my name into the sources and said that I do it on the page. # # # need profiler for creating the file "profiler.tmp" # # step 1 # link this program with your own program like this : "awkc profiler my_program" # after running the program "profiler.exe", a file called "profiler.tmp" # is created. # step 2 # Run "profdisp", (in the same directory) # and have a look on the resulting file "profiler.res" with MS-DOS edit or another editor... # BEGIN { local lig,num,profil_tab,profil_nom,mod=0,snm,tmpa while (getline lig < "PROFILER.TMP") { if (mod) { split(lig,tmpa,"\t") profil_tab[profil_nom[tmpa[1]]][tmpa[2]]=tmpa[3] } else { if (lig!="") { split(lig,tmpa,"\t") profil_nom[tmpa[1]]=tmpa[3] } else mod=1 } } close("PROFILER.TMP") rmfile("PROFILER.TMP") if (filesize("PROFILER.RES")!=-1) rmfile("PROFILER.RES") for (i in profil_tab) { printf "\n\n\n%s\n%s\n\n",i,strdup("-",length(alltrim(i))) > "PROFILER.RES" if (filesize(i)!=-1) { num=1 while (getline lig < i) { snm=sprintf("%06d",num) if (snm in profil_tab[i]) print profil_tab[i][snm] " | " lig > "PROFILER.RES" else print "------ | " lig > "PROFILER.RES" num++ } close(i) } else print "fichier non trouvé" > "PROFILE.RES" } close("PROFILER.RES") } function alltrim(str) { local d=1,i,l,p,r="" l=length(str) p=l for (i=1;i<=l;i++) if (substr(str,i,1)!=" ") { if (i>d) d=i if (i