apxc-analysis.py 1.73 KB
Newer Older
Sudheer Chunduri's avatar
Sudheer Chunduri committed
1
#!/usr/bin/env python
Sudheer Chunduri's avatar
Sudheer Chunduri committed
2 3 4 5 6 7
# DarshanUtils for Python for processing APXC records

# This script gives an overview of features provided by the Python bindings for DarshanUtils.

# By default all APXC module records, metadata, and the name records are loaded when opening a Darshan log:

Sudheer Chunduri's avatar
Sudheer Chunduri committed
8 9
import argparse
import darshan
Sudheer Chunduri's avatar
Sudheer Chunduri committed
10 11 12 13 14 15
import cffi
import numpy
import pandas
import matplotlib
import matplotlib.pyplot as plt 
import seaborn as sns 
Sudheer Chunduri's avatar
Sudheer Chunduri committed
16

Sudheer Chunduri's avatar
Sudheer Chunduri committed
17 18 19 20 21
#import pprint
import pandas as pd
import numpy as np
import jinja2
import logging
Sudheer Chunduri's avatar
Sudheer Chunduri committed
22

Sudheer Chunduri's avatar
Sudheer Chunduri committed
23 24 25 26 27 28 29 30 31
from darshan.backend.cffi_backend import ffi 

logger = logging.getLogger(__name__)
from darshan.report import DarshanReport
import darshan.backend.cffi_backend as backend
import darshan
import time
from matplotlib.backends.backend_pdf import FigureCanvasPdf, PdfPages
from matplotlib.figure import Figure
Sudheer Chunduri's avatar
Sudheer Chunduri committed
32 33


Sudheer Chunduri's avatar
Sudheer Chunduri committed
34 35 36 37 38 39 40 41 42 43 44 45 46
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--quiet",
        dest="quiet",
        action="store_true",
        default=False,
        help="Surpress zero count calls",
    )
    parser.add_argument(
        "logname", metavar="logname", type=str, nargs=1, help="Logname to parse"
    )
    args = parser.parse_args()
Sudheer Chunduri's avatar
Sudheer Chunduri committed
47

Sudheer Chunduri's avatar
Sudheer Chunduri committed
48 49 50 51 52 53 54
    report = darshan.DarshanReport(args.logname[0], read_all=False)
    report.info()
   
    if "APXC" not in report.modules:
        print("This log does not contain AutoPerf XC data")
        return
    r = report.mod_read_all_apxc_records("APXC")
Sudheer Chunduri's avatar
Sudheer Chunduri committed
55

Sudheer Chunduri's avatar
Sudheer Chunduri committed
56 57 58 59
    report.update_name_records()
    report.info()
   
    #pdf = matplotlib.backends.backend_pdf.PdfPages("apxc_output.pdf")
Sudheer Chunduri's avatar
Sudheer Chunduri committed
60

Sudheer Chunduri's avatar
Sudheer Chunduri committed
61 62 63 64 65 66 67
    header_rec = report.records["APXC"][0]
    
    for rec in report.records["APXC"][1:]:
	# skip the first record which is header record
        print(rec)

    return
Sudheer Chunduri's avatar
Sudheer Chunduri committed
68 69

if __name__ == '__main__':
Sudheer Chunduri's avatar
Sudheer Chunduri committed
70
    main()