java - Measuring loading time of Excel -


i searching solution on 1 week. maybe have solution problem:

i want measure time need open excel file excel. first solution start measurement line of code:

processbuilder command = new processbuilder("cmd", "/c",                         <excel_path>,                         <file-location>);                 command.start();                 long start = system.currenttimemillis(); 

and check ram-usage via process explorer. if excel finish loading ram usage still same , stop measurement. see fuzzy , not solution.

as second solution open socketserver in java , wait until excel call workbook_open()- method after finishing loading file. within method send socket connection java server (i give host , port parameter excel) , measure time.

this efficient in company not allowed auto run scripts if don’t stored in trusted zone. cannot change policy’s not solution. have idea how measure loading time of excel-file in excel? not no solution track loading time in excel?

updated answer:

you can use dde attempting connect (initiate conversation) desired file repeatedly, , measure time passes until succeed.

please notice far precise measuring, , should used estimation.

have @ this project based on this one, example of using dde java , ms excel.

details:

you can't connect excel file dde before loading has completed inside excel program, , can serve purpose.
right after starting excel, can attempt connect file dde (repeatedly or 100ms delay avoiding cpu load) until succeed, , calculate time after success.

pseudo code:

ts = now();  d = dde("file.xlsx");  while (d.error) {      d = dde("file.xlsx");  }  load_time = now() - ts; 


old version of answer: if use workbook's vba, think there's simple solution.

you can write current time new temporary local file, right before opening file, , write current time (now) within workbook_open subroutine, same temporary file, @ second line.

then able track file until has 2 lines ongoing interval, , calculate difference between timestamps.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -