mirror of
https://github.com/systemd/systemd
synced 2025-10-06 00:13:24 +02:00
cgtop: rename enum value to match its string repr.
This commit is contained in:
@@ -66,7 +66,7 @@ typedef enum {
|
|||||||
} Order;
|
} Order;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CPU_PERCENT,
|
CPU_PERCENTAGE,
|
||||||
CPU_TIME,
|
CPU_TIME,
|
||||||
_CPU_MAX,
|
_CPU_MAX,
|
||||||
_CPU_INVALID = -EINVAL,
|
_CPU_INVALID = -EINVAL,
|
||||||
@@ -83,7 +83,7 @@ static bool arg_recursive = true;
|
|||||||
static bool arg_recursive_unset = false;
|
static bool arg_recursive_unset = false;
|
||||||
static PidsCount arg_count = COUNT_PIDS;
|
static PidsCount arg_count = COUNT_PIDS;
|
||||||
static Order arg_order = ORDER_CPU;
|
static Order arg_order = ORDER_CPU;
|
||||||
static CPUType arg_cpu_type = CPU_PERCENT;
|
static CPUType arg_cpu_type = CPU_PERCENTAGE;
|
||||||
|
|
||||||
static const char *order_table[_ORDER_MAX] = {
|
static const char *order_table[_ORDER_MAX] = {
|
||||||
[ORDER_PATH] = "path",
|
[ORDER_PATH] = "path",
|
||||||
@@ -96,8 +96,8 @@ static const char *order_table[_ORDER_MAX] = {
|
|||||||
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(order, Order);
|
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(order, Order);
|
||||||
|
|
||||||
static const char *cpu_type_table[_CPU_MAX] = {
|
static const char *cpu_type_table[_CPU_MAX] = {
|
||||||
[CPU_PERCENT] = "percentage",
|
[CPU_PERCENTAGE] = "percentage",
|
||||||
[CPU_TIME] = "time",
|
[CPU_TIME] = "time",
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(cpu_type, CPUType);
|
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(cpu_type, CPUType);
|
||||||
@@ -530,7 +530,7 @@ static int group_compare(Group * const *a, Group * const *b) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_CPU:
|
case ORDER_CPU:
|
||||||
if (arg_cpu_type == CPU_PERCENT) {
|
if (arg_cpu_type == CPU_PERCENTAGE) {
|
||||||
if (x->cpu_valid && y->cpu_valid) {
|
if (x->cpu_valid && y->cpu_valid) {
|
||||||
r = CMP(y->cpu_fraction, x->cpu_fraction);
|
r = CMP(y->cpu_fraction, x->cpu_fraction);
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
@@ -624,7 +624,7 @@ static void display(Hashmap *a) {
|
|||||||
|
|
||||||
if (on_tty()) {
|
if (on_tty()) {
|
||||||
const char *on, *off;
|
const char *on, *off;
|
||||||
int cpu_len = arg_cpu_type == CPU_PERCENT ? 6 : maxtcpu;
|
int cpu_len = arg_cpu_type == CPU_PERCENTAGE ? 6 : maxtcpu;
|
||||||
|
|
||||||
path_columns = columns() - 36 - cpu_len;
|
path_columns = columns() - 36 - cpu_len;
|
||||||
if (path_columns < 10)
|
if (path_columns < 10)
|
||||||
@@ -642,7 +642,7 @@ static void display(Hashmap *a) {
|
|||||||
arg_order == ORDER_TASKS ? off : "",
|
arg_order == ORDER_TASKS ? off : "",
|
||||||
arg_order == ORDER_CPU ? on : "",
|
arg_order == ORDER_CPU ? on : "",
|
||||||
cpu_len,
|
cpu_len,
|
||||||
arg_cpu_type == CPU_PERCENT ? "%CPU" : "CPU Time",
|
arg_cpu_type == CPU_PERCENTAGE ? "%CPU" : "CPU Time",
|
||||||
arg_order == ORDER_CPU ? off : "",
|
arg_order == ORDER_CPU ? off : "",
|
||||||
arg_order == ORDER_MEMORY ? on : "", "Memory",
|
arg_order == ORDER_MEMORY ? on : "", "Memory",
|
||||||
arg_order == ORDER_MEMORY ? off : "",
|
arg_order == ORDER_MEMORY ? off : "",
|
||||||
@@ -672,7 +672,7 @@ static void display(Hashmap *a) {
|
|||||||
else
|
else
|
||||||
fputs(" -", stdout);
|
fputs(" -", stdout);
|
||||||
|
|
||||||
if (arg_cpu_type == CPU_PERCENT) {
|
if (arg_cpu_type == CPU_PERCENTAGE) {
|
||||||
if (g->cpu_valid)
|
if (g->cpu_valid)
|
||||||
printf(" %6.1f", g->cpu_fraction*100);
|
printf(" %6.1f", g->cpu_fraction*100);
|
||||||
else
|
else
|
||||||
@@ -976,7 +976,7 @@ static int loop(const char *root) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '%':
|
case '%':
|
||||||
arg_cpu_type = arg_cpu_type == CPU_TIME ? CPU_PERCENT : CPU_TIME;
|
arg_cpu_type = arg_cpu_type == CPU_TIME ? CPU_PERCENTAGE : CPU_TIME;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'k':
|
case 'k':
|
||||||
|
Reference in New Issue
Block a user