Algorithms :: Maths :: searching a source code |
|||
| By: progGoon |
Date: 06/01/2003 00:00:00 |
Points: 50 | Status: Answered Quality : Excellent |
|
Can any one help me where I can look for a source code of a program that can compute of a total frequency time algorithm? because I really need it for my theses. Your help will be very much appreciated. |
|||
| By: VGR | Date: 06/01/2003 23:23:00 | Type : Comment |
|
| could you explain "total frequency time" ? |
|||
| By: monange | Date: 07/01/2003 00:22:00 | Type : Comment |
|
| listening |
|||
| By: TheFalklands | Date: 07/01/2003 01:20:00 | Type : Comment |
|
| ditto - <yawn> |
|||
| By: progGoon | Date: 13/01/2003 20:08:00 | Type : Comment |
|
| the total frequency time is used in " data structure and algorithm " it counts how my time the loop and the test, initialization and others of a statement program. |
|||
| By: VGR | Date: 13/01/2003 21:27:00 | Type : Answer |
|
| yes basically you are trying to profile your code like Logiscope does ;-) you search for the bottlenecks ? ;-) you ***have to*** instrument your code ; as you have the SOURCE code, it's pretty easy : just insert statements like CountOn, CountDown computing elapsed time via subtracting Time() values, and put the results in a memory array or (better) a database or (why not) a textfile globally opened for writing. it's easy. FYI, here are time counting functions in an old unit of mine. What I would do if I were you is to say "CountOn;" before calling a procedure or function, and "CountOff;" on exit. Then the value TimeCount (a real 48 bits) will hold the execution time. Then store somewhere that "for procedure X the time has been Y ms", like in : WriteLn(txtfile,'proc ',#9,TimeCount); // #9=TAB, 'proc' has to be the name of the function or procedure just called and measured At the end of execution, build or print out the profile of your application by analysing the data (via eXcel, via an other Pascal program, via whatever you want) {############################################# unit de gestion du temps rel } Unit Temps_reel; Interface {$O+,F+} Uses WinProcs; Type time_string=string[11]; Var DosHour,DosMinute,DosSecond,DosCent : word; Var TimeInit : time_string; Var TimeCount : real; { secondes apr s arrts ventuels } { suppr 2.36 : Function Time : time_string; } Function DeltaTime : real; Procedure CountOff; Procedure CountOn; Procedure Delay ( ms : Word ); {############################################# ajout pour les dates. } Type date_string=string[19]; { passage 19 le MERCREDI 19/10/94 !!!!!!!! } Function fDate ( complet : Boolean ) : Date_string; {############################################# IMPLEMENTATION } Implementation Uses SysUtils; { pour Time } (* 2.34 : Function Time; Var hour,minute,second,cent:string[2]; Begin GetTime(DosHour,DosMinute,DosSecond,DosCent); Str(DosHour:2,hour); If DosHour<10 Then hour[1]:='0'; Str(DosMinute:2,minute); If DosMinute<10 Then minute[1]:='0'; Str(DosSecond:2,second); If DosSecond<10 Then second[1]:='0'; Str(DosCent:2,cent); If DosCent<10 Then cent[1]:='0'; Time:=hour+':'+minute+':'+second+'.'+cent; End; *) {########################### Extension @HEFIZ'88 #############################} Function DeltaTime; Var a : time_string; b,c,d,e,f : real; code : integer; Begin a:=TimeToStr(Time); Val(a[1]+a[2],b,code); Val(TimeInit[1]+TimeInit[2],c,code); b:=b-c; Val(a[4]+a[5],c,code); Val(TimeInit[4]+TimeInit[5],d,code); c:=c-d; Val(a[7]+a[8],d,code); Val(TimeInit[7]+TimeInit[8],e,code); d:=d-e; Val(a[10]+a[11],e,code); Val(TimeInit[10]+TimeInit[11],f,code); e:=e-f; DeltaTime:=b*3600+c*60+d+e/100; End; Procedure CountOff; Begin TimeCount:=TimeCount+DeltaTime; { TimeInit:=Time; pour mesure de temps en dehors de COUNTON ??? }{ intert ??? } End; Procedure CountOn; Begin TimeInit:=TimeToStr(Time); End; Function fDate; Var res : date_string; lDate : TDateTime; jourPlus : Integer; Begin res:=''; lDate:=Date; { c'est maintenant Now pour Date+Time } res:=DateToStr(lDate); jourplus:=DayOfWeek(lDate); If complet Then Begin { jour de la semaine } Case jourplus Of 1 : res:='Dimanche '+res; 2 : res:='Lundi '+res; 3 : res:='Mardi '+res; 4 : res:='Mercredi '+res; 5 : res:='Jeudi '+res; 6 : res:='Vendredi '+res; 7 : res:='Samedi '+res; End; { of CASE } End Else res:=' '+res; fDate:=res; End; { function fDATE } Procedure Delay; { ( ms : Word ); } Var timin : LongInt; Begin timin:=GetTickCount; Repeat Until GetTickCount-timin>=ms; { ok si ms < 49 jours en millisecondes... } End; { Delay procedure, ex-Crt Unit } Begin { Init Part } TimeCount:=0; (*2.34 : WriteLn('TEMPS REL'); *) End. { of Implementation } {#############################################################################} |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








