Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main():
if debug_track_memory:
memory_tracker = pympler.tracker.SummaryTracker()
for func in [
test_cython_type,
test_move_transforms,
test_typespecialize,
test_typespecialize_no_checks,
test_parallel,
test_loopimplicit,
test_mutate,
test_dependencies,
test_is_consistent,
test_apply_macros,
test_loop_fusion]:
for i in range(3 if debug_track_memory else 1):
func()
if debug_track_memory:
memory_tracker.print_diff()
cur = self._pg.cursor()
try:
cur.execute("select 'asdf'")
cur.fetchall()
finally:
cur.close()
def _ping_pylibmc(self, i):
self._pylibmc.set('a', 1)
self._pylibmc.incr('a', 2)
self._pylibmc.decr('a', 1)
if __name__ == '__main__':
k = KitchenSink()
t = pympler.tracker.SummaryTracker()
for i in itertools.count():
# do the work
k.ping(i)
# periodically print stats
if i % 500 == 0:
t.print_diff()
time.sleep(0.0001)
def __init__(self):
super(MemoryProfilerDaemonProcess, self).__init__()
config = get_config()
self.enabled = config.getboolean('daemon', 'memory-profiler', False)
self.interval = config.getint('debug', 'memory_profiler_interval', 60)
self.track = config.getint('debug', 'memory_profiler_track_changes', 0)
self.verbose = config.getint('debug', 'memory_profiler_verbose', 0)
self.summary_tracker = tracker.SummaryTracker()
def printListingUsage(self, args):
all_objects = muppy.get_objects()
sum1 = summary.summarize(all_objects)
summary.print_(sum1)
print(" ")
print("Summary: ")
tr = tracker.SummaryTracker()
tr.print_diff()
def create_tracker():
if pympler is None:
return
global tr
tr = pympler.tracker.SummaryTracker()
global gluMult
global displayStartDate
global meanPlot
global lastMeanTestDateTime
global nextMeanNn
global highPercentText
global midPercentText
global lowPercentText
global batt_text
global lastPowerState
global lastPowerLevel
#print 'plotGraph() entry\n++++++++++++++++++++++++++++++++++++++++++++++++'
if firstPlotGraph == 1:
if args.debug:
tr = tracker.SummaryTracker()
ax = fig.add_subplot(1, 1, 1)
# rotate labels a bit to use less vertical space
plt.xticks(rotation=30)
# mpl.dates.MinuteLocator(interval=15)
ax.xaxis.set_major_locator(mpl.dates.DayLocator())
ax.xaxis.set_minor_locator(mpl.dates.HourLocator())
ax.xaxis.set_major_formatter(majorFormatter)
ax.xaxis.set_minor_formatter(minorFormatter)
ax.autoscale_view()
ax.grid(True)
ax.tick_params(direction='out', pad=10)
ax.set_xlabel('Date & Time', labelpad=-12)
ax.set_ylabel('Glucose (%s)'%gluUnits, labelpad=10)
def startmemorytracker():
from pympler import tracker
tr = tracker.SummaryTracker()
return tr
import networkx as nx
from pynetsym import core, configurators, simulation
from pympler.classtracker import ClassTracker
from pympler import tracker
from pympler import muppy
# trck = ClassTracker()
from pynetsym.nodes import Node
st = tracker.SummaryTracker()
class Node(Node):
def activate(self):
pass
class Simulation(simulation.Simulation):
class configurator_type(configurators.NXGraphConfigurator):
node_type = Node
node_options = {}
# trck.track_class(core.Agent, resolution_level=5)
# trck.track_class(Node, resolution_level=5)
st.print_diff()
g = nx.powerlaw_cluster_graph(5000, 20, 0.1)