#NEWLINE# def take_sample( self , sample_number , force_memory = False ) : #NEWLINE# #INDENT# timestamp_ms = ( ( self . time_fxn ( ) - self . start_time ) * 1000 ) #NEWLINE# for ( thread_id , active_frame ) in sys . _current_frames ( ) . items ( ) : #NEWLINE# #INDENT# if ( thread_id == self . current_request_thread_id ) : #NEWLINE# #INDENT# self . samples . append ( ProfileSample . from_frame_and_timestamp ( active_frame , thread_id ) ) #NEWLINE# #UNINDENT# #UNINDENT# if self . memory_sample_every : #NEWLINE# #INDENT# if ( force_memory or ( ( sample_number % self . memory_sample_every ) == 0 ) ) : #NEWLINE# #INDENT# self . memory_samples [ timestamp_ms ] = get_memory ( )