Time and System Info

In the good ole days, users of EnSight could execute the “test: start_timer” and the “test: print_timer” to attempt to retrieve information about the time that it took to perform the operations between those two commands. Well, that may be not really enough information, or information that you can easily use or report. Python to the rescue again, this time courtesy of Randy’s “snapshot” function.

You can now use EnSight’s Python “snapshot” function to store in a dictionary not only timestamp information, but also information about client and server application memory as well as client and server memory load.

In python, you can call:

ensight.message_window.memory_snapshot("Info_t1")

“Info_t1” can be anything that you want. This creates a snapshot of client and server memory, as well timestamp information.

The call :

ensight.query(ensight.SYSINFO)['memory_snapshots']

returns a dictionary of the snapshots, indexed by the name that you gave it (in this case “Info_t1”). If you then print this line, you would get the following information:

{ 'Info_t1': {'server_freeram': 5980388,
             'timestamp': 1310502681.3050001,
             'client_freeram': 5980388,
             'server_totalram': 10485092,
             'client_appram': 247852,
             'client_cores': 8,
             'server_appram': 14288,
             'server_cores': 8,
             'client_totalram': 10485092},
}

So, let’s put this together into something useful:

ensight.message_window.memory_snapshot("Info_t1")
# Do something interesting here.
ensight.message_window.memory_snapshot("Info_t2")
d = ensight.query(ensight.SYSINFO)['memory_snapshots']
print "="*36
print "Client Ram Increase " ,(float(d['Info_t2']['client_appram']) - float(d['Info_t1']['client_appram'])) / 1024.0, " Mb"
print "Server Ram Increase " ,(float(d['Info_t2']['server_appram']) - float(d['Info_t1']['server_appram'])) / 1024.0, " Mb"
print "Time to execute was    " ,float(d['Info_t2']['timestamp']) - float(d['Info_t1']['timestamp']), " sec"

 

Leave a Reply