I can get time of one operation insert to database, but I have problem to get time for 1000 operations. I get end time in the function to call when the request is sent successfully.
var startTime = 0;
var endTime = 0;
function func(){
startTime = new Date();
tx.executeSql('INSERT INTO tblDemo ('
+ 'personName, personAge, personColour)'
+ 'VALUES (?, ?, ?);'
, [name, age, colour], querySuccess, errorHandler);
setTimeout(function(){
var result = endTime-startTime;
alert(result);
}, 10000);
}
function querySuccess() {
endTime = new Date();
}
I can't use loop in this code, because operations are executed asynchronously and I can't get end time after 1000 operations.