Reputation: 1
I need to measure the time elapsed between requesting data from a database and the moment the data are visualized.
I'm working with a webclient which is relating to a big database. When creating a report (as pdf document) the webclient will access the database. While accessing and calculating the needed data for the report, the pdf document already opens in a new page in the web browser and shows 'about:blank' as URL and 'waiting for ...' (... = relating the place it's waiting for). I actually need the time elapsed from the 'waiting for ...'.
My idea is to measure the time, from the moment the new window for the pdf document opens until the end of 'about:blank', by simply using:
long lStartTime = System.currentTimeMillis();
//task that identifies the opening of webpage til end of 'about:blank'
long lEndTime = System.currentTimeMillis();
long difference = lEndTime - lStartTime;
System.out.println("Elapsed time: " + difference);
The problem is, I don't know how to implement the task as described above. Is there anybody with a similar problem or has an idea how to implement the code?
I appreciate every help. I'm not very used to programming, but I do have some basic skills.
Thanks in advance!
Upvotes: 0
Views: 146
Reputation: 4584
I assume that you need to measure this time for troubleshooting performance issues. In this case you can use existing solutions for profiling.
For example you can use Sniffy - it will measure the time spent for executing the SQL Query and will return it as HTTP header as well as on the web page itself
Upvotes: 1