# Question:Evaluate the frequency of a processor

## Question:Evaluate the frequency of a processor

Maple
I'm currently working on a school project, the issue is to find approximately the speed of a processor. I made a script which gives the time necessary to calculate a big factorial (10000! for instance). This time (gived by the function time()) is the total CPU time needed to calculate this factorial. But know, I need to know the total number of processor cycle per instruction (CPI) necessary to calculate the factorial. I explain : maybe you already know that the processor run by cycles which has a link with the frequency of the processor. If i can evaluate the number of processor cycle necessary to make a multiplication or the calculation of a factorial (even if this number is approximate) I would be able to find the speed of my processor. Here is the code i use for evaluate the time of a factorial (4 different methods) ```> # Utilisation de la fonction factoriel "!" maple : factoriel_1:=proc() local i,u,o; u:=NULL; for i from 1 to 50 do o:=time((i*10^3)!); u:=u,o; od; RETURN(u) end: > # Utilisation de la fonction produit "product()" maple : factoriel_2:=proc() local i,u,o,k; u:=NULL; for i from 1 to 50 do o:=time(product(k,k=1..i*10^3)); u:=u,o; od; RETURN(u) end: > # Utilisation d'un algorithme itératif : factoriel_3:=proc() local i,j,u,o,n,st; u:=NULL; for i from 1 to 25 do st:= time(): for j from 1 to i*10^3 do n:=n*j; od; o:=time() - st; u:=u,o; od; RETURN(u) end: > # Utilisation d'un algorithme récursif : # Mise en place de la procédure de récursivité recur:=proc(n,k) if (n*(k-1) = 0) then RETURN(n) else RETURN(recur(n*(k-1),k-1)) end if; end: # Procédure permettant de calculer le temps globale d'exécution des récursions jusqu'au résultat de la factoriel finale : factoriel_4:=proc() local u,i,o; u:=NULL; for i from 1 to 15 do o:=time(recur(i*10^3,i*10^3)); u:=u,o; od; RETURN(u) end: ``` Have you any information or maybe ideas? Regards, Nicolas C., Autun - France
﻿