-
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.
less: Add highlight feature for search
Signed-off-by: iipeace <[email protected]>
- Loading branch information
Showing
1 changed file
with
23 additions
and
5 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__ = "240126" | ||
__revision__ = "240127" | ||
__maintainer__ = "Peace Lee" | ||
__email__ = "[email protected]" | ||
__repository__ = "https://github.com/iipeace/guider" | ||
|
@@ -25846,6 +25846,7 @@ class SysMgr(object): | |
maxBlkRd = 0 | ||
maxBlkWr = 0 | ||
maxCpuUsage = 0 | ||
maxCpuSteal = 0 | ||
maxGpuMemUsage = 0 | ||
maxGpuUsage = 0 | ||
maxInterval = 0 | ||
|
@@ -28207,6 +28208,7 @@ def clearStats(): | |
SysMgr.maxBlkRd = 0 | ||
SysMgr.maxBlkWr = 0 | ||
SysMgr.maxCpuUsage = 0 | ||
SysMgr.maxCpuSteal = 0 | ||
SysMgr.maxGpuMemUsage = 0 | ||
SysMgr.maxGpuUsage = 0 | ||
SysMgr.maxInterval = 0 | ||
|
@@ -28246,6 +28248,7 @@ def getPeakList(incInter=True): | |
"blkRdMB": SysMgr.maxBlkRd, | ||
"blkWrMB": SysMgr.maxBlkWr, | ||
"cpuPer": SysMgr.maxCpuUsage, | ||
"cpuStealPer": SysMgr.maxCpuSteal, | ||
"diskFreeMB": SysMgr.minDiskFree, | ||
"gpuPer": SysMgr.maxGpuUsage, | ||
"gpumemMB": SysMgr.maxGpuMemUsage, | ||
|
@@ -28445,6 +28448,7 @@ def doLess(inputArg=None): | |
wbuf = [] | ||
cursor = 0 | ||
lastWord = "" | ||
colorWord = "" | ||
|
||
# check input # | ||
if inputArg: | ||
|
@@ -28477,9 +28481,18 @@ def doLess(inputArg=None): | |
|
||
def _printPage(wbuf, cursor): | ||
SysMgr.clearScreen() | ||
SysMgr.printPipe( | ||
wbuf[cursor : cursor + SysMgr.ttyRows - 2], pager=False | ||
) | ||
|
||
pbuf = wbuf[cursor : cursor + SysMgr.ttyRows - 2] | ||
|
||
# apply color # | ||
if colorWord: | ||
coloredWord = UtilMgr.convColor(colorWord, "REVERSE") | ||
for pidx in range(len(pbuf)): | ||
pbuf[pidx] = UtilMgr.removeColor(pbuf[pidx]).replace( | ||
colorWord, coloredWord | ||
) | ||
|
||
SysMgr.printPipe(pbuf, pager=False) | ||
|
||
def _readPipe(wbuf, pipeInput): | ||
while 1: | ||
|
@@ -28657,6 +28670,8 @@ def _handleInput(key, cursor, wbuf, lastWord, lastKey): | |
cursor, lastWord, lastKey = _handleInput( | ||
k.strip(), cursor, wbuf, lastWord, lastKey | ||
) | ||
if lastWord: | ||
colorWord = lastWord | ||
|
||
# clear screen and print a page # | ||
_printPage(wbuf, cursor) | ||
|
@@ -132072,9 +132087,12 @@ def printSystemUsage(self): | |
or (peakUptime and SysMgr.uptime >= peakUptime) | ||
or (peakRuntime and SysMgr.getRuntime(sec=True) >= peakRuntime) | ||
): | ||
# CPU # | ||
# CPU usage # | ||
SysMgr.maxCpuUsage = max(SysMgr.maxCpuUsage, totalUsage) | ||
|
||
# CPU steal # | ||
SysMgr.maxCpuSteal = max(SysMgr.maxCpuSteal, stealUsage) | ||
|
||
# GPU # | ||
try: | ||
SysMgr.maxGpuUsage = max( | ||
|