'Threaded collection of performance data:
This method sets up a simple semaphor system for signalling
when you would like to start and stop a threaded data collection
method.  The collection runs every period seconds until the
semaphor attribute is set to a non-true value (which normally
should be done by calling query.collectdatawhile_stop() .)
e.g.:
query.collectdatawhile(2)
# starts the query running, returns control to the caller immediately
# is collecting data every two seconds.
# do whatever you want to do while the thread runs, then call:
query.collectdatawhile_stop()
# when you want to deal with the data.  It is generally a good idea
# to sleep for period seconds yourself, since the query will not copy
# the required data until the next iteration:
time.sleep(2)
# now you can access the data from the attributes of the query
query.curresults
query.curpaths'

def collectdatawhile(self, period=1):

    self.collectdatawhile_active = 1
    thread.start_new_thread(self.collectdatawhile_slave, (period,))
