-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: iipeace <[email protected]>
- Loading branch information
Showing
1 changed file
with
102 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
__credits__ = "Peace Lee" | ||
__license__ = "GPLv2" | ||
__version__ = "3.9.8" | ||
__revision__ = "240920" | ||
__revision__ = "240921" | ||
__maintainer__ = "Peace Lee" | ||
__email__ = "[email protected]" | ||
__repository__ = "https://github.com/iipeace/guider" | ||
|
@@ -38278,6 +38278,9 @@ def printHelp(force=False, isExit=True): | |
# {0:1} {1:1} -o . | ||
# {0:1} {1:1} -o . -q NOBACKUP | ||
|
||
- {3:1} {2:1} and {5:1} {4:1} with core summary | ||
# {0:1} {1:1} -o . -e c -q CORESUMMARY | ||
|
||
- {3:1} {2:1} and {5:1} {4:1} with memory details of top 10 processes | ||
# {0:1} {1:1} -o . -q NRPROCMEM:10 | ||
|
||
|
@@ -43100,6 +43103,9 @@ def _getDesc(s, t=0): | |
# {0:1} {1:1} output.out -g "a.out*" | ||
# {0:1} {1:1} "output*.out" -g "*a.out*" | ||
|
||
- {2:1} with core summary | ||
# {0:1} {1:1} "report1.out, report2.out.gz" -q CORESUMMARY | ||
|
||
- {2:1} with kernel memory | ||
# {0:1} {1:1} "report1.out, report2.out.gz" -q INCKERNELMEM | ||
|
||
|
@@ -132247,10 +132253,7 @@ def parseProcLine(index, procLine): | |
procIntData["total"] = dict(TA.init_procIntData) | ||
|
||
# save CPU usage on this interval # | ||
try: | ||
procIntData["total"]["cpu"] = cpu | ||
except: | ||
procIntData["total"]["cpu"] = 0 | ||
procIntData["total"]["cpu"] = cpu | ||
|
||
# save blkwait on this interval # | ||
try: | ||
|
@@ -132599,8 +132602,30 @@ def parseProcLine(index, procLine): | |
|
||
return | ||
|
||
# core # | ||
elif len(tokens) == 6 and tokens[0].startswith("Core/"): | ||
m = re.findall( | ||
r"Core/\s*(?P<core>\d+)\|\s*(?P<usage>\d+)\s*%", procLine | ||
) | ||
if not m: | ||
return | ||
|
||
TA.procTotData["total"].setdefault("core", {}) | ||
procIntData["total"].setdefault("core", {}) | ||
|
||
for l in m: | ||
core, usage = l[0], long(l[1]) | ||
|
||
# sum core usage # | ||
TA.procTotData["total"]["core"][core] = ( | ||
TA.procTotData["total"]["core"].get("core", 0) + usage | ||
) | ||
|
||
# save core usage on this interval # | ||
procIntData["total"]["core"][core] = usage | ||
|
||
# WARN: each tab's the number of tokens # | ||
# task(10), GPU(5), storage(12), network(13), cgroup(10) | ||
# task(10), GPU(5), storage(12), network(13), cgroup(10), core(6) | ||
|
||
# check return condition # | ||
if "ONLYTOTAL" in SysMgr.environList: | ||
|
@@ -133223,6 +133248,76 @@ def printEventInterval(): | |
|
||
_printer("%s\n" % oneLine) | ||
|
||
@staticmethod | ||
def printCoreInterval(): | ||
# check skip flag # | ||
if not "CORESUMMARY" in SysMgr.environList: | ||
return | ||
elif not "core" in TaskAnalyzer.procTotData["total"]: | ||
return | ||
|
||
if SysMgr.jsonEnable: | ||
_printer = lambda x: x | ||
else: | ||
_printer = SysMgr.printPipe | ||
|
||
TA = TaskAnalyzer | ||
|
||
# set comm and pid size # | ||
_printer("\n[Top Core Info] (Unit: %%)\n%s\n" % twoLine) | ||
|
||
# Print menu # | ||
procInfo = "{0:>4} | {1:>4} |".format("Core", "Avg") | ||
procInfoLen = len(procInfo) | ||
maxLineLen = SysMgr.lineLength | ||
margin = 2 | ||
|
||
# Print timeline # | ||
TA.printTimelineInterval(margin, procInfoLen, procInfo, 1) | ||
|
||
# Print usage of cores # | ||
nrPrint = 0 | ||
for core, usage in sorted( | ||
TA.procTotData["total"]["core"].items(), key=lambda e: long(e[0]) | ||
): | ||
procInfo = "{0:>4} | {1:>4} |".format( | ||
core, long(usage / len(TA.procIntData)) | ||
) | ||
|
||
timeLine = "" | ||
lineLen = len(procInfo) | ||
total = 0 | ||
for idx in xrange(len(TA.procIntData)): | ||
if lineLen + margin > maxLineLen: | ||
timeLine += "\n" + (" " * (procInfoLen - 1)) + "| " | ||
lineLen = len(procInfo) | ||
|
||
if core in TA.procIntData[idx]["total"]["core"]: | ||
try: | ||
usage = TA.procIntData[idx]["total"]["core"][core] | ||
except SystemExit: | ||
sys.exit(0) | ||
except: | ||
usage = 0 | ||
total += usage | ||
else: | ||
usage = 0 | ||
|
||
timeLine += "{0:>3} ".format(str(usage)) | ||
lineLen += margin + 2 | ||
|
||
# skip process used no value # | ||
if total == 0: | ||
continue | ||
|
||
_printer( | ||
("{0:1} {1:1}\n{2:1}\n").format(procInfo, timeLine, oneLine) | ||
) | ||
nrPrint += 1 | ||
|
||
if nrPrint == 0: | ||
_printer(" None\n%s" % oneLine) | ||
|
||
@staticmethod | ||
def printCpuInterval(attr="cpu"): | ||
def _conv(val): | ||
|
@@ -134894,6 +134989,7 @@ def _initData(): | |
if not onlyTotal: | ||
TaskAnalyzer.printEventInterval() | ||
TaskAnalyzer.printCpuInterval() | ||
TaskAnalyzer.printCoreInterval() | ||
TaskAnalyzer.printDlyInterval() | ||
TaskAnalyzer.printPrioInterval() | ||
TaskAnalyzer.printGpuInterval() | ||
|