-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert "Remove instperf" #5356
Revert "Remove instperf" #5356
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ dist_systemd_DATA = anaconda.service \ | |
anaconda.target \ | ||
[email protected] \ | ||
[email protected] \ | ||
instperf.service \ | ||
anaconda-sshd.service \ | ||
anaconda-nm-config.service \ | ||
anaconda-nm-disable-autocons.service \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[Unit] | ||
ConditionKernelCommandLine=debug | ||
Description=anaconda performance monitor | ||
Before=anaconda.service | ||
|
||
[Service] | ||
WorkingDirectory=/ | ||
ExecStart=/usr/bin/instperf |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/python3 | ||
|
||
import logging | ||
from subprocess import Popen, PIPE | ||
import time | ||
|
||
# grab the top five memory consuming processes, returning them in a string of | ||
# of the format: | ||
# | ||
# name1:kB1,name2:kB2,...,name5:kB5 | ||
def topProcesses(): | ||
output = Popen(["ps", "-eo", "comm,rss", "--sort", "-rss", "--no-headers"], stdout=PIPE, universal_newlines=True).communicate()[0] | ||
top5 = output.split("\n")[:5] | ||
return ",".join("%s:%s" % (proc[0], proc[1]) for proc in (s.split() for s in top5)) | ||
|
||
def logit(): | ||
buffers = 0 | ||
cached = 0 | ||
memTotal = 0 | ||
memFree = 0 | ||
swapTotal = 0 | ||
swapFree = 0 | ||
|
||
with open("/proc/meminfo") as f: | ||
for line in f.readlines(): | ||
if line.startswith("Buffers:"): | ||
buffers = line.split()[1] | ||
elif line.startswith("Cached:"): | ||
cached = line.split()[1] | ||
elif line.startswith("MemTotal:"): | ||
memTotal = line.split()[1] | ||
elif line.startswith("MemFree:"): | ||
memFree = line.split()[1] | ||
elif line.startswith("SwapTotal:"): | ||
swapTotal = line.split()[1] | ||
elif line.startswith("SwapFree:"): | ||
swapFree = line.split()[1] | ||
|
||
d = {"memUsed": int(memTotal)-int(memFree)-int(cached)-int(buffers), | ||
"swapUsed": int(swapTotal)-int(swapFree), | ||
"procs": topProcesses()} | ||
|
||
mem_logger.debug("%(memUsed)d %(swapUsed)d %(procs)s", d) | ||
|
||
mem_logger = logging.getLogger("memLog") | ||
mem_logger.setLevel(logging.DEBUG) | ||
|
||
handler = logging.FileHandler("/tmp/memory.dat") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you write a simple kickstart test for this script, please? I think it might be enough to start an installation with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please use mkstmp because using /tmp ended up causing problems #5375 |
||
handler.setLevel(logging.DEBUG) | ||
handler.setFormatter(logging.Formatter("%(asctime)s %(message)s", "%H:%M:%S")) | ||
mem_logger.addHandler(handler) | ||
|
||
while True: | ||
logit() | ||
time.sleep(1) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This script processes a memory.dat file as generated by instperf during | ||
# installation and writes out a graph to memusage.png. | ||
set terminal png size 1024,768 | ||
set output "memusage.png" | ||
set title "anaconda Memory Usage" | ||
set xlabel "Time" | ||
set xtics rotate | ||
set xdata time | ||
set timefmt "%H:%M:%S" | ||
set ylabel "Memory Used (in KB)\n(Total-Free-Buffers-Cached)" | ||
set format y "%.0f" | ||
set grid | ||
|
||
plot "memory.dat" using 1:2 title "Memory" with lines, \ | ||
"memory.dat" using 1:3 title "Swap" with lines |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please extend the comment with information that we have about this script and its use cases?