def gather_cpu_data(): print 'Collecting CPU data...' cpu_loads = get_cpu_stats(app.config['CPU_SAMPLER_TIME']) cs = CpuStats(cpu_loads) db.session.add(cs) db.session.commit() db.session.flush()
def hello(): our_response = render_template( 'show_stats.html', cpu_data=enumerate(get_cpu_stats()), mem_data=get_memory_stats(), process_list=get_process_list(), comments=(Commentage.query.all()), ) return our_response
def hello(): our_response = render_template( 'show_stats.html', cpu_data=enumerate(get_cpu_stats( app.config['CPU_SAMPLER_TIME'])), mem_data=get_memory_stats(), process_list=get_process_list(), comments=(Commentage.query.all()), cpu_history=( CpuStats.query.order_by( CpuStats.created.desc() ).limit(50) ), ) return our_response