Exemplo n.º 1
0
def pickleMPStat(mpstat_file, pickle_dir, stats_dir):

    # Parse the mpstat log file
    mstats = MPStatParser(mpstat_file)

    # Pickle CPU utilization data
    mpstat_pfile = os.path.join(pickle_dir, 'mpstat_p.txt')
    kernel_usage = mstats.kernel_usage()
    summary = mstats.summary()
    data = (kernel_usage, summary)
    fd = open(mpstat_pfile, 'wb')
    cPickle.dump(data, fd)
    fd.close()

    # Write stats about CPU utilization
    cpu_stats_file = os.path.join(stats_dir, 'cpu_util.txt')
    cpu_stats_fd = open(cpu_stats_file, 'w')
    cpu_stats_fd.write('Kernel usage (average) = %s\n' % str(kernel_usage))
    cpu_stats_fd.write('--- Average usage breakdown ---\n')
    cpu_stats_fd.write(str(summary))
    cpu_stats_fd.close()
Exemplo n.º 2
0
def pickleMPStat(mpstat_file, pickle_dir, stats_dir):

    # Parse the mpstat log file
    mstats = MPStatParser(mpstat_file)

    # Pickle CPU utilization data
    mpstat_pfile = os.path.join(pickle_dir, 'mpstat_p.txt')
    kernel_usage = mstats.kernel_usage()
    summary = mstats.summary()
    data = (kernel_usage, summary)
    fd = open(mpstat_pfile, 'wb')
    cPickle.dump(data, fd)
    fd.close()

    # Write stats about CPU utilization
    cpu_stats_file = os.path.join(stats_dir, 'cpu_util.txt')
    cpu_stats_fd = open(cpu_stats_file, 'w')
    cpu_stats_fd.write('Kernel usage (average) = %s\n' % str(kernel_usage))
    cpu_stats_fd.write('--- Average usage breakdown ---\n')
    cpu_stats_fd.write(str(summary))
    cpu_stats_fd.close()