Re: CPU times
- To: mathgroup at smc.vnet.net
- Subject: [mg13345] Re: [mg13228] CPU times
- From: "Jens-Peer Kuska" <kuska at linmpi.mpg.de>
- Date: Mon, 20 Jul 1998 02:50:01 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Hi, Your first problem is to find out what operating system You are using! If You find out, that You are working with Windows 95 You are happy because the time information of Win95 is broken and You need to do nothing. On a unix system the times() function return a struct with the user, total and cpu time for the individual process. So in Your C++ code You can only get the CPU time that is spend by this process not the time the is spend by the Mathematica kernel. Mathematica's Timing[] function returns the time of the kernel evaluation and something like MLPutFunction(linkToMath,"Timing",1); ... /* whats to be done by Mathematica */ /* waiting for the result */ while(MLNextPacket(linkToMath)!=RETURNPKT)) MLNewPacket(linkToMath); /* Timing[] returns {time * Second, result } */ MLGetFunction(linkToMath,"List",&mustBe2); MLGetFunction(linkToMath,"Times",&mustBeAlso2); MLGetDouble(linkToMath,&theCPUTime); MLGetSymbol(linkToMath,&theSecondSymbol); MLDisownSymbol(linkToMath,&theSecondSymbol); ... /* get Your result */ will work. Hope that helps Jens -----Original Message----- From: SAgca at lnc.com <SAgca at lnc.com> To: mathgroup at smc.vnet.net Subject: [mg13345] [mg13228] CPU times > Hi > I have some more questions. I am carrying out a research where I >use multivariate probabilities extensilevly. I am using some >approximation algorithms and numerical methods. I want to compare the results >with Mathematica results. Now I have 2 problems: > > 1. I am working on C++, and I need to call Mathematica from the >code at various points. > 2. I need the CPU time. If I use the CPU time of C++ code where I >am calling Mathematica, will it give accurate CPU time? > > Thanks. > > Senay > >