• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2''' This Python script interprets interrupt values.
3    Validates Ideal load balancer runs in same package where workload is running
4'''
5
6import os
7import sys
8from optparse import OptionParser
9from pm_sched_mc import *
10
11__author__ = "Poornima Nayak <mpnayak@linux.vnet.ibm.com>"
12
13class Usage(Exception):
14    def __init__(self, msg):
15        self.msg = msg
16
17def main(argv=None):
18    if argv is None:
19        argv = sys.argv
20
21    usage = "-w"
22    parser = OptionParser(usage)
23    parser.add_option("-c", "--mc_level", dest="mc_level",
24        default=0, help="Sched mc power saving value 0/1/2")
25    parser.add_option("-t", "--smt_level", dest="smt_level",
26        default=0, help="Sched smt power saving value 0/1/2")
27    parser.add_option("-w", "--workload", dest="work_ld",
28        default="ebizzy", help="Workload can be ebizzy/kernbench")
29    (options, args) = parser.parse_args()
30
31    try:
32        count_num_cpu()
33        count_num_sockets()
34        if is_multi_socket():
35            set_sched_mc_power(options.mc_level)
36        if is_hyper_threaded():
37            set_sched_smt_power(options.smt_level)
38        map_cpuid_pkgid()
39        print("INFO: Created table mapping cpu to package")
40        background="no"
41        duration=120
42        pinned="yes"
43
44        trigger_workld(options.smt_level,options.work_ld, "single_job", duration, background, pinned, "no")
45        generate_loc_intr_report()
46        status = validate_ilb(options.mc_level, options.smt_level)
47        reset_schedmc()
48        if is_hyper_threaded():
49            reset_schedsmt()
50        return(status)
51
52    except Exception as details:
53        print("INFO: Idle Load Balancer test failed", details)
54        return(1)
55
56if __name__ == "__main__":
57    sys.exit(main())
58