jeudi 21 juillet 2016

Measure the execution time of a function call in C++

How can I measure the execution time of a line of code in C++in Windows. I am inserting about 1,00,000 records boost::multi_index_container as follows: while(...) //read a single record from a csv file until EOF { ... while(...) // split the record into components based on delimiter { ... } //insert into boost::multi_index_container } I need to find the time required to insert all the records, but without the execution time of loops. Starting a timer or anything just before insert function and calculating the elapsed time just after the function call gives 0 nanoseconds as the result. So I cannot calculate the time by summing up the individual times. What is the solution?

Aucun commentaire:

Enregistrer un commentaire