mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 14:28:17 +03:00
remove stats memory command
Summary: `eden stats memory` was never useful because it shows system statistics which you can get better from `top`, `htop`, or `atop`. Reviewed By: genevievehelsel Differential Revision: D21392737 fbshipit-source-id: 010021b8a97bd8ba8ac289d906acc3c3ecd10768
This commit is contained in:
parent
1c4c0f4024
commit
8b5c1e66b7
@ -116,44 +116,6 @@ def do_stats_general(
|
||||
)
|
||||
|
||||
|
||||
@stats_cmd("memory", "Show memory statistics for Eden")
|
||||
class MemoryCmd(Subcmd):
|
||||
def run(self, args: argparse.Namespace) -> int:
|
||||
out = sys.stdout
|
||||
stats_print.write_heading("Memory Stats for EdenFS", out)
|
||||
instance = cmd_util.get_eden_instance(args)
|
||||
|
||||
with instance.get_thrift_client() as client:
|
||||
counters = client.getCounters()
|
||||
stats_print.write_mem_status_table(counters, out)
|
||||
|
||||
# print memory counters
|
||||
heading = "Average values of Memory usage and availability"
|
||||
out.write("\n\n %s \n\n" % heading.center(80, " "))
|
||||
|
||||
table = get_memory_counters(counters)
|
||||
stats_print.write_table(table, "", out)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
# Returns all the memory counters in ServiceData in a table format.
|
||||
def get_memory_counters(counters: DiagInfoCounters) -> Table:
|
||||
table: Table = {}
|
||||
index = {"60": 0, "600": 1, "3600": 2}
|
||||
for key in counters:
|
||||
if key.startswith("memory") and key.find(".") != -1:
|
||||
tokens = key.split(".")
|
||||
memKey = tokens[0].replace("_", " ")
|
||||
if memKey not in table.keys():
|
||||
table[memKey] = [0, 0, 0, 0]
|
||||
if len(tokens) == 2:
|
||||
table[memKey][3] = counters[key]
|
||||
else:
|
||||
table[memKey][index[tokens[2]]] = counters[key]
|
||||
return table
|
||||
|
||||
|
||||
@stats_cmd("io", "Show information about the number of I/O calls")
|
||||
class IoCmd(Subcmd):
|
||||
def setup_parser(self, parser: argparse.ArgumentParser) -> None:
|
||||
|
@ -16,23 +16,6 @@ def write_heading(heading: str, out: TextIO) -> None:
|
||||
out.write(_center_strip_right(border, 80) + "\n")
|
||||
|
||||
|
||||
def write_mem_status_table(fuse_counters, out: TextIO) -> None:
|
||||
format_str = "{:>40} {:^1} {:<20}"
|
||||
keys = [
|
||||
"memory_free",
|
||||
"memory_free_percent",
|
||||
"memory_usage",
|
||||
"memory_usage_percent",
|
||||
]
|
||||
for key in keys:
|
||||
if key.endswith("_percent"):
|
||||
value = "%d%s" % (fuse_counters[key], "%")
|
||||
else:
|
||||
value = "%f(GB)" % (fuse_counters[key] / (10 ** 6))
|
||||
centered_text = format_str.format(key.replace("_", " "), ":", value)
|
||||
out.write(centered_text.rstrip() + "\n")
|
||||
|
||||
|
||||
LATENCY_FORMAT_STR = "{:<12} {:^4} {:^10} {:>10} {:>15} {:>10} {:>10}\n"
|
||||
|
||||
|
||||
|
@ -39,23 +39,6 @@ access | p90 9 10 11 12
|
||||
stats_print.write_latency_record("access", matrix, out)
|
||||
self.assertEqual(out.getvalue(), expected_output)
|
||||
|
||||
def test_print_mem_status(self):
|
||||
dictionary = {
|
||||
"memory_free": 1234567,
|
||||
"memory_free_percent": 50,
|
||||
"memory_usage": 45678912,
|
||||
"memory_usage_percent": 70,
|
||||
}
|
||||
expected_output = """\
|
||||
memory free : 1.234567(GB)
|
||||
memory free percent : 50%
|
||||
memory usage : 45.678912(GB)
|
||||
memory usage percent : 70%
|
||||
"""
|
||||
out = StringIO()
|
||||
stats_print.write_mem_status_table(dictionary, out)
|
||||
self.assertEqual(expected_output, out.getvalue())
|
||||
|
||||
def test_print_table(self):
|
||||
table = {
|
||||
"key1": [1, 2, 3, 4],
|
||||
|
@ -211,12 +211,6 @@ def statslatency(ui, **opts):
|
||||
return _calledenfsctl(ui, "stats latency", opts=opts)
|
||||
|
||||
|
||||
@statscmd("memory", [], norepo=True)
|
||||
def statsmemory(ui, **opts):
|
||||
"""show memory statistics for the edenfs daemon"""
|
||||
return _calledenfsctl(ui, "stats memory")
|
||||
|
||||
|
||||
@statscmd("thrift", [], norepo=True)
|
||||
def statsthrift(ui, **opts):
|
||||
"""show the number of received thrift calls"""
|
||||
|
Loading…
Reference in New Issue
Block a user