🚀 use ftime to calculate run time

This commit is contained in:
ValKmjolnir
2022-06-02 22:51:43 +08:00
parent 04ab09586b
commit 7ec8418740
5 changed files with 49 additions and 30 deletions

View File

@@ -107,9 +107,11 @@ void execute(const std::string& file,const uint32_t cmd)
}
else if(cmd&VM_EXECTIME)
{
clock_t t=clock();
timeb begin,end;
ftime(&begin);
vm.run(gen,linker,cmd&VM_OPCALLNUM,cmd&VM_DBGINFO);
std::cout<<"process exited after "<<((double)(clock()-t))/CLOCKS_PER_SEC<<"s.\n";
ftime(&end);
std::cout<<"process exited after "<<((end.time-begin.time)*1.0+end.millitm/1000.0-begin.millitm/1000.0)<<"s.\n";
}
else if(cmd&VM_EXEC)
vm.run(gen,linker,cmd&VM_OPCALLNUM,cmd&VM_DBGINFO);