-
-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathos_linux.rs
More file actions
989 lines (975 loc) · 27.2 KB
/
Copy pathos_linux.rs
File metadata and controls
989 lines (975 loc) · 27.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
pub mod ccgroup;
pub mod cgroup;
pub mod command;
pub mod context_sw;
pub mod voluntary_context_sw;
pub mod involuntary_context_sw;
pub mod cpu_time;
#[cfg(feature = "docker")]
pub mod docker;
pub mod eip;
pub mod elapsed_time;
pub mod empty;
pub mod env;
pub mod esp;
pub mod file_name;
pub mod gid;
pub mod gid_fs;
pub mod gid_real;
pub mod gid_saved;
pub mod group;
pub mod group_fs;
pub mod group_real;
pub mod group_saved;
pub mod maj_flt;
pub mod min_flt;
pub mod multi_slot;
pub mod nice;
pub mod pgid;
pub mod pid;
pub mod policy;
pub mod ppid;
pub mod priority;
pub mod processor;
pub mod read_bytes;
pub mod rt_priority;
pub mod sec_context;
pub mod separator;
pub mod session;
pub mod shd_pnd;
pub mod sig_blk;
pub mod sig_cgt;
pub mod sig_ign;
pub mod sig_pnd;
pub mod slot;
pub mod ssb;
pub mod start_time;
pub mod state;
pub mod tcp_port;
pub mod threads;
pub mod tree;
pub mod tree_slot;
pub mod tty;
pub mod udp_port;
pub mod uid;
pub mod uid_fs;
pub mod uid_login;
pub mod uid_real;
pub mod uid_saved;
pub mod usage_cpu;
pub mod usage_mem;
pub mod user;
pub mod user_fs;
pub mod user_login;
pub mod user_real;
pub mod user_saved;
pub mod vm_data;
pub mod vm_exe;
pub mod vm_hwm;
pub mod vm_lib;
pub mod vm_lock;
pub mod vm_peak;
pub mod vm_pin;
pub mod vm_pte;
pub mod vm_rss;
pub mod vm_size;
pub mod vm_stack;
pub mod vm_swap;
pub mod wchan;
pub mod work_dir;
pub mod write_bytes;
pub use self::ccgroup::Ccgroup;
pub use self::cgroup::Cgroup;
pub use self::command::Command;
pub use self::context_sw::ContextSw;
pub use self::voluntary_context_sw::VoluntaryContextSw;
pub use self::involuntary_context_sw::InvoluntaryContextSw;
pub use self::cpu_time::CpuTime;
#[cfg(feature = "docker")]
pub use self::docker::Docker;
pub use self::eip::Eip;
pub use self::elapsed_time::ElapsedTime;
pub use self::empty::Empty;
pub use self::env::Env;
pub use self::esp::Esp;
pub use self::file_name::FileName;
pub use self::gid::Gid;
pub use self::gid_fs::GidFs;
pub use self::gid_real::GidReal;
pub use self::gid_saved::GidSaved;
pub use self::group::Group;
pub use self::group_fs::GroupFs;
pub use self::group_real::GroupReal;
pub use self::group_saved::GroupSaved;
pub use self::maj_flt::MajFlt;
pub use self::min_flt::MinFlt;
pub use self::multi_slot::MultiSlot;
pub use self::nice::Nice;
pub use self::pgid::Pgid;
pub use self::pid::Pid;
pub use self::policy::Policy;
pub use self::ppid::Ppid;
pub use self::priority::Priority;
pub use self::processor::Processor;
pub use self::read_bytes::ReadBytes;
pub use self::rt_priority::RtPriority;
pub use self::sec_context::SecContext;
pub use self::separator::Separator;
pub use self::session::Session;
pub use self::shd_pnd::ShdPnd;
pub use self::sig_blk::SigBlk;
pub use self::sig_cgt::SigCgt;
pub use self::sig_ign::SigIgn;
pub use self::sig_pnd::SigPnd;
pub use self::slot::Slot;
pub use self::ssb::Ssb;
pub use self::start_time::StartTime;
pub use self::state::State;
pub use self::tcp_port::TcpPort;
pub use self::threads::Threads;
pub use self::tree::Tree;
pub use self::tree_slot::TreeSlot;
pub use self::tty::Tty;
pub use self::udp_port::UdpPort;
pub use self::uid::Uid;
pub use self::uid_fs::UidFs;
pub use self::uid_login::UidLogin;
pub use self::uid_real::UidReal;
pub use self::uid_saved::UidSaved;
pub use self::usage_cpu::UsageCpu;
pub use self::usage_mem::UsageMem;
pub use self::user::User;
pub use self::user_fs::UserFs;
pub use self::user_login::UserLogin;
pub use self::user_real::UserReal;
pub use self::user_saved::UserSaved;
pub use self::vm_data::VmData;
pub use self::vm_exe::VmExe;
pub use self::vm_hwm::VmHwm;
pub use self::vm_lib::VmLib;
pub use self::vm_lock::VmLock;
pub use self::vm_peak::VmPeak;
pub use self::vm_pin::VmPin;
pub use self::vm_pte::VmPte;
pub use self::vm_rss::VmRss;
pub use self::vm_size::VmSize;
pub use self::vm_stack::VmStack;
pub use self::vm_swap::VmSwap;
pub use self::wchan::Wchan;
pub use self::work_dir::WorkDir;
pub use self::write_bytes::WriteBytes;
use crate::column::Column;
use once_cell::sync::Lazy;
use serde_derive::{Deserialize, Serialize};
use std::collections::BTreeMap;
use std::path::PathBuf;
// ---------------------------------------------------------------------------------------------------------------------
// ConfigColumnKind
// ---------------------------------------------------------------------------------------------------------------------
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum ConfigColumnKind {
Ccgroup,
Cgroup,
Command,
ContextSw,
VoluntaryContextSw,
InvoluntaryContextSw,
CpuTime,
Docker,
Eip,
ElapsedTime,
Empty,
Env,
Esp,
FileName,
Gid,
GidFs,
GidReal,
GidSaved,
Group,
GroupFs,
GroupReal,
GroupSaved,
MajFlt,
MinFlt,
MultiSlot,
Nice,
Pgid,
Pid,
Policy,
Ppid,
Priority,
Processor,
ReadBytes,
RtPriority,
SecContext,
Separator,
Session,
ShdPnd,
Slot,
SigBlk,
SigCgt,
SigIgn,
SigPnd,
Ssb,
StartTime,
State,
TcpPort,
Threads,
Tree,
TreeSlot,
Tty,
UdpPort,
Uid,
UidFs,
UidLogin,
UidReal,
UidSaved,
UsageCpu,
UsageMem,
User,
UserFs,
UserLogin,
UserReal,
UserSaved,
Username,
VmData,
VmExe,
VmHwm,
VmLib,
VmLock,
VmPeak,
VmPin,
VmPte,
VmRss,
VmSize,
VmStack,
VmSwap,
Wchan,
WorkDir,
WriteBytes,
}
// ---------------------------------------------------------------------------------------------------------------------
// gen_column
// ---------------------------------------------------------------------------------------------------------------------
pub fn gen_column(
kind: &ConfigColumnKind,
header: Option<String>,
_docker_path: &str,
separator: &str,
abbr_sid: bool,
tree_symbols: &[String; 5],
procfs: Option<PathBuf>,
) -> Box<dyn Column> {
match kind {
ConfigColumnKind::Ccgroup => Box::new(Ccgroup::new(header)),
ConfigColumnKind::Cgroup => Box::new(Cgroup::new(header)),
ConfigColumnKind::Command => Box::new(Command::new(header)),
ConfigColumnKind::ContextSw => Box::new(ContextSw::new(header)),
ConfigColumnKind::VoluntaryContextSw => Box::new(VoluntaryContextSw::new(header)),
ConfigColumnKind::InvoluntaryContextSw => Box::new(InvoluntaryContextSw::new(header)),
ConfigColumnKind::CpuTime => Box::new(CpuTime::new(header)),
#[cfg(feature = "docker")]
ConfigColumnKind::Docker => Box::new(Docker::new(header, _docker_path)),
#[cfg(not(feature = "docker"))]
ConfigColumnKind::Docker => Box::new(Empty::new()),
ConfigColumnKind::Eip => Box::new(Eip::new(header)),
ConfigColumnKind::ElapsedTime => Box::new(ElapsedTime::new(header)),
ConfigColumnKind::Empty => Box::new(Empty::new()),
ConfigColumnKind::Env => Box::new(Env::new(header, procfs)),
ConfigColumnKind::Esp => Box::new(Esp::new(header)),
ConfigColumnKind::FileName => Box::new(FileName::new(header)),
ConfigColumnKind::Gid => Box::new(Gid::new(header, abbr_sid)),
ConfigColumnKind::GidFs => Box::new(GidFs::new(header)),
ConfigColumnKind::GidReal => Box::new(GidReal::new(header)),
ConfigColumnKind::GidSaved => Box::new(GidSaved::new(header)),
ConfigColumnKind::Group => Box::new(Group::new(header, abbr_sid)),
ConfigColumnKind::GroupFs => Box::new(GroupFs::new(header)),
ConfigColumnKind::GroupReal => Box::new(GroupReal::new(header)),
ConfigColumnKind::GroupSaved => Box::new(GroupSaved::new(header)),
ConfigColumnKind::MajFlt => Box::new(MajFlt::new(header)),
ConfigColumnKind::MinFlt => Box::new(MinFlt::new(header)),
ConfigColumnKind::MultiSlot => Box::new(MultiSlot::new()),
ConfigColumnKind::Nice => Box::new(Nice::new(header)),
ConfigColumnKind::Pgid => Box::new(Pgid::new(header)),
ConfigColumnKind::Pid => Box::new(Pid::new(header)),
ConfigColumnKind::Policy => Box::new(Policy::new(header)),
ConfigColumnKind::Ppid => Box::new(Ppid::new(header)),
ConfigColumnKind::Priority => Box::new(Priority::new(header)),
ConfigColumnKind::Processor => Box::new(Processor::new(header)),
ConfigColumnKind::ReadBytes => Box::new(ReadBytes::new(header)),
ConfigColumnKind::RtPriority => Box::new(RtPriority::new(header)),
ConfigColumnKind::SecContext => Box::new(SecContext::new(header, procfs)),
ConfigColumnKind::Separator => Box::new(Separator::new(separator)),
ConfigColumnKind::Session => Box::new(Session::new(header)),
ConfigColumnKind::ShdPnd => Box::new(ShdPnd::new(header)),
ConfigColumnKind::Slot => Box::new(Slot::new()),
ConfigColumnKind::SigBlk => Box::new(SigBlk::new(header)),
ConfigColumnKind::SigCgt => Box::new(SigCgt::new(header)),
ConfigColumnKind::SigIgn => Box::new(SigIgn::new(header)),
ConfigColumnKind::SigPnd => Box::new(SigPnd::new(header)),
ConfigColumnKind::Ssb => Box::new(Ssb::new(header)),
ConfigColumnKind::StartTime => Box::new(StartTime::new(header)),
ConfigColumnKind::State => Box::new(State::new(header)),
ConfigColumnKind::TcpPort => Box::new(TcpPort::new(header)),
ConfigColumnKind::Threads => Box::new(Threads::new(header)),
ConfigColumnKind::Tree => Box::new(Tree::new(tree_symbols)),
ConfigColumnKind::TreeSlot => Box::new(TreeSlot::new()),
ConfigColumnKind::Tty => Box::new(Tty::new(header)),
ConfigColumnKind::UdpPort => Box::new(UdpPort::new(header)),
ConfigColumnKind::Uid => Box::new(Uid::new(header, abbr_sid)),
ConfigColumnKind::UidFs => Box::new(UidFs::new(header)),
ConfigColumnKind::UidLogin => Box::new(UidLogin::new(header)),
ConfigColumnKind::UidReal => Box::new(UidReal::new(header)),
ConfigColumnKind::UidSaved => Box::new(UidSaved::new(header)),
ConfigColumnKind::UsageCpu => Box::new(UsageCpu::new(header)),
ConfigColumnKind::UsageMem => Box::new(UsageMem::new(header)),
ConfigColumnKind::User => Box::new(User::new(header, abbr_sid)),
ConfigColumnKind::UserFs => Box::new(UserFs::new(header)),
ConfigColumnKind::UserLogin => Box::new(UserLogin::new(header)),
ConfigColumnKind::UserReal => Box::new(UserReal::new(header)),
ConfigColumnKind::UserSaved => Box::new(UserSaved::new(header)),
ConfigColumnKind::Username => Box::new(User::new(header, abbr_sid)),
ConfigColumnKind::VmData => Box::new(VmData::new(header)),
ConfigColumnKind::VmExe => Box::new(VmExe::new(header)),
ConfigColumnKind::VmHwm => Box::new(VmHwm::new(header)),
ConfigColumnKind::VmLib => Box::new(VmLib::new(header)),
ConfigColumnKind::VmLock => Box::new(VmLock::new(header)),
ConfigColumnKind::VmPeak => Box::new(VmPeak::new(header)),
ConfigColumnKind::VmPin => Box::new(VmPin::new(header)),
ConfigColumnKind::VmPte => Box::new(VmPte::new(header)),
ConfigColumnKind::VmRss => Box::new(VmRss::new(header)),
ConfigColumnKind::VmSize => Box::new(VmSize::new(header)),
ConfigColumnKind::VmStack => Box::new(VmStack::new(header)),
ConfigColumnKind::VmSwap => Box::new(VmSwap::new(header)),
ConfigColumnKind::Wchan => Box::new(Wchan::new(header)),
ConfigColumnKind::WorkDir => Box::new(WorkDir::new(header, procfs)),
ConfigColumnKind::WriteBytes => Box::new(WriteBytes::new(header)),
}
}
// ---------------------------------------------------------------------------------------------------------------------
// KIND_LIST
// ---------------------------------------------------------------------------------------------------------------------
pub static KIND_LIST: Lazy<BTreeMap<ConfigColumnKind, (&'static str, &'static str)>> =
Lazy::new(|| {
[
(
ConfigColumnKind::Ccgroup,
("Ccgroup", "Control group by compressed format"),
),
(ConfigColumnKind::Cgroup, ("Cgroup", "Control group")),
(
ConfigColumnKind::Command,
("Command", "Command with all arguments"),
),
(
ConfigColumnKind::ContextSw,
("ContextSw", "Context switch count"),
),
(
ConfigColumnKind::VoluntaryContextSw,
("VoluntaryContextSw", "Voluntary context switch count"),
),
(
ConfigColumnKind::InvoluntaryContextSw,
("InvoluntaryContextSw", "Involuntary context switch count"),
),
(
ConfigColumnKind::CpuTime,
("CpuTime", "Cumulative CPU time"),
),
(
ConfigColumnKind::Docker,
("Docker", "Docker container name"),
),
(ConfigColumnKind::Eip, ("Eip", "Instruction pointer")),
(
ConfigColumnKind::ElapsedTime,
("ElapsedTime", "Elapsed time"),
),
(ConfigColumnKind::Empty, ("Empty", "Empty")),
(ConfigColumnKind::Env, ("Env", "Environment variables")),
(ConfigColumnKind::Esp, ("Esp", "Stack pointer")),
(ConfigColumnKind::FileName, ("FileName", "File name")),
(ConfigColumnKind::Gid, ("Gid", "Group ID")),
(ConfigColumnKind::GidFs, ("GidFs", "File system group ID")),
(ConfigColumnKind::GidReal, ("GidReal", "Real group ID")),
(ConfigColumnKind::GidSaved, ("GidSaved", "Saved group ID")),
(ConfigColumnKind::Group, ("Group", "Group name")),
(
ConfigColumnKind::GroupFs,
("GroupFs", "File system group name"),
),
(
ConfigColumnKind::GroupReal,
("GroupReal", "Real group name"),
),
(
ConfigColumnKind::GroupSaved,
("GroupSaved", "Saved group name"),
),
(
ConfigColumnKind::MajFlt,
("MajFlt", "Major page fault count"),
),
(
ConfigColumnKind::MinFlt,
("MinFlt", "Minor page fault count"),
),
(
ConfigColumnKind::MultiSlot,
("MultiSlot", "Slot for `--insert` option"),
),
(ConfigColumnKind::Nice, ("Nice", "Nice value")),
(ConfigColumnKind::Pgid, ("Pgid", "Process group ID")),
(ConfigColumnKind::Pid, ("Pid", "Process ID")),
(ConfigColumnKind::Policy, ("Policy", "Scheduling policy")),
(ConfigColumnKind::Ppid, ("Ppid", "Parent process ID")),
(ConfigColumnKind::Priority, ("Priority", "Priority")),
(
ConfigColumnKind::Processor,
("Processor", "Currently assigned processor"),
),
(
ConfigColumnKind::ReadBytes,
("ReadBytes", "Read bytes from storage"),
),
(
ConfigColumnKind::RtPriority,
("RtPriority", "Real-time priority"),
),
(
ConfigColumnKind::SecContext,
("SecContext", "Security context"),
),
(
ConfigColumnKind::Separator,
("Separator", "Show | for column separation"),
),
(ConfigColumnKind::Session, ("Session", "Process Session ID")),
(
ConfigColumnKind::ShdPnd,
("ShdPnd", "Pending signal mask for process"),
),
(
ConfigColumnKind::Slot,
("Slot", "Slot for `--insert` option"),
),
(ConfigColumnKind::SigBlk, ("SigBlk", "Blocked signal mask")),
(ConfigColumnKind::SigCgt, ("SigCgt", "Caught signal mask")),
(ConfigColumnKind::SigIgn, ("SigIgn", "Ignored signal mask")),
(
ConfigColumnKind::SigPnd,
("SigPnd", "Pending signal mask for thread"),
),
(
ConfigColumnKind::Ssb,
("Ssb", "Speculative store bypass status"),
),
(ConfigColumnKind::StartTime, ("StartTime", "Starting time")),
(ConfigColumnKind::State, ("State", "Process state")),
(ConfigColumnKind::TcpPort, ("TcpPort", "Bound TCP ports")),
(ConfigColumnKind::Threads, ("Threads", "Thread count")),
(
ConfigColumnKind::TreeSlot,
("TreeSlot", "Slot for tree column"),
),
(ConfigColumnKind::Tty, ("Tty", "Controlling TTY")),
(ConfigColumnKind::UdpPort, ("UdpPort", "Bound UDP ports")),
(ConfigColumnKind::Uid, ("Uid", "User ID")),
(ConfigColumnKind::UidFs, ("UidFs", "File system user ID")),
(ConfigColumnKind::UidLogin, ("UidLogin", "Login user ID")),
(ConfigColumnKind::UidReal, ("UidReal", "Real user ID")),
(ConfigColumnKind::UidSaved, ("UidSaved", "Saved user ID")),
(ConfigColumnKind::UsageCpu, ("UsageCpu", "CPU utilization")),
(
ConfigColumnKind::UsageMem,
("UsageMem", "Memory utilization"),
),
(ConfigColumnKind::User, ("User", "User name")),
(
ConfigColumnKind::UserFs,
("UserFs", "File system user name"),
),
(
ConfigColumnKind::UserLogin,
("UserLogin", "Login user name"),
),
(ConfigColumnKind::UserReal, ("UserReal", "Real user name")),
(
ConfigColumnKind::UserSaved,
("UserSaved", "Saved user name"),
),
(ConfigColumnKind::VmData, ("VmData", "Data size")),
(ConfigColumnKind::VmExe, ("VmExe", "Text segments size")),
(ConfigColumnKind::VmHwm, ("VmHwm", "Peak resident set size")),
(ConfigColumnKind::VmLib, ("VmLib", "Library code size")),
(ConfigColumnKind::VmLock, ("VmLock", "Locked memory size")),
(
ConfigColumnKind::VmPeak,
("VmPeak", "Peak virtual memory size"),
),
(ConfigColumnKind::VmPin, ("VmPin", "Pinned memory size")),
(
ConfigColumnKind::VmPte,
("VmPte", "Page table entries size"),
),
(ConfigColumnKind::VmRss, ("VmRss", "Resident set size")),
(ConfigColumnKind::VmSize, ("VmSize", "Physical page size")),
(ConfigColumnKind::VmStack, ("VmStack", "Stack size")),
(
ConfigColumnKind::VmSwap,
("VmSwap", "Swapped-out virtual memory size"),
),
(
ConfigColumnKind::Wchan,
("Wchan", "Process sleeping kernel function"),
),
(
ConfigColumnKind::WorkDir,
("WorkDir", "Current working directory"),
),
(
ConfigColumnKind::WriteBytes,
("WriteBytes", "Write bytes to storage"),
),
]
.iter()
.cloned()
.collect()
});
// ---------------------------------------------------------------------------------------------------------------------
// CONFIG_DEFAULT
// ---------------------------------------------------------------------------------------------------------------------
pub static CONFIG_DEFAULT: &str = r#"
[[columns]]
kind = "Pid"
style = "BrightYellow|Yellow"
numeric_search = true
nonnumeric_search = false
[[columns]]
kind = "User"
style = "BrightGreen|Green"
numeric_search = false
nonnumeric_search = true
[[columns]]
kind = "Separator"
style = "White|BrightBlack"
numeric_search = false
nonnumeric_search = false
[[columns]]
kind = "Tty"
style = "BrightWhite|Black"
numeric_search = false
nonnumeric_search = false
[[columns]]
kind = "UsageCpu"
style = "ByPercentage"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "UsageMem"
style = "ByPercentage"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "CpuTime"
style = "BrightCyan|Cyan"
numeric_search = false
nonnumeric_search = false
[[columns]]
kind = "MultiSlot"
style = "ByUnit"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "Separator"
style = "White|BrightBlack"
numeric_search = false
nonnumeric_search = false
[[columns]]
kind = "Command"
style = "BrightWhite|Black"
numeric_search = false
nonnumeric_search = true
"#;
// ---------------------------------------------------------------------------------------------------------------------
// CONFIG_LARGE
// ---------------------------------------------------------------------------------------------------------------------
pub static CONFIG_LARGE: &str = r#"
[[columns]]
kind = "Pid"
style = "BrightYellow|Yellow"
numeric_search = true
nonnumeric_search = false
align = "Left"
[[columns]]
kind = "User"
style = "BrightGreen|Green"
numeric_search = false
nonnumeric_search = true
align = "Left"
[[columns]]
kind = "Separator"
style = "White|BrightBlack"
numeric_search = false
nonnumeric_search = false
align = "Left"
[[columns]]
kind = "State"
style = "ByState"
numeric_search = false
nonnumeric_search = false
align = "Left"
[[columns]]
kind = "Nice"
style = "BrightMagenta|Magenta"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "Tty"
style = "BrightWhite|Black"
numeric_search = false
nonnumeric_search = false
align = "Left"
[[columns]]
kind = "UsageCpu"
style = "ByPercentage"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "UsageMem"
style = "ByPercentage"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "VmSize"
style = "ByUnit"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "VmRss"
style = "ByUnit"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "TcpPort"
style = "BrightCyan|Cyan"
numeric_search = true
nonnumeric_search = false
align = "Left"
max_width = 20
[[columns]]
kind = "UdpPort"
style = "BrightCyan|Cyan"
numeric_search = true
nonnumeric_search = false
align = "Left"
max_width = 20
[[columns]]
kind = "ReadBytes"
style = "ByUnit"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "WriteBytes"
style = "ByUnit"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "Slot"
style = "ByUnit"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "Separator"
style = "White|BrightBlack"
numeric_search = false
nonnumeric_search = false
align = "Left"
[[columns]]
kind = "CpuTime"
style = "BrightCyan|Cyan"
numeric_search = false
nonnumeric_search = false
align = "Left"
[[columns]]
kind = "StartTime"
style = "BrightMagenta|Magenta"
numeric_search = false
nonnumeric_search = false
align = "Left"
[[columns]]
kind = "Docker"
style = "BrightGreen|Green"
numeric_search = false
nonnumeric_search = true
align = "Left"
[[columns]]
kind = "Separator"
style = "White|BrightBlack"
numeric_search = false
nonnumeric_search = false
align = "Left"
[[columns]]
kind = "Command"
style = "BrightWhite|Black"
numeric_search = false
nonnumeric_search = true
align = "Left"
"#;
// ---------------------------------------------------------------------------------------------------------------------
// CONFIG_ALL
// ---------------------------------------------------------------------------------------------------------------------
#[cfg(test)]
pub static CONFIG_ALL: &str = r#"
[[columns]]
kind = "Ccgroup"
style = "BrightRed"
align = "Left"
[[columns]]
kind = "Cgroup"
style = "BrightRed"
align = "Left"
[[columns]]
kind = "Command"
style = "BrightRed"
align = "Left"
[[columns]]
kind = "ContextSw"
style = "BrightRed"
align = "Right"
[[columns]]
kind = "VoluntaryContextSw"
style = "BrightRed"
align = "Right"
[[columns]]
kind = "InvoluntaryContextSw"
style = "BrightRed"
align = "Right"
[[columns]]
kind = "CpuTime"
style = "BrightGreen"
align = "Center"
[[columns]]
kind = "Docker"
style = "BrightMagenta"
[[columns]]
kind = "Eip"
style = "BrightYellow"
[[columns]]
kind = "ElapsedTime"
style = "BrightYellow"
[[columns]]
kind = "Empty"
style = "BrightYellow"
[[columns]]
kind = "Env"
style = "BrightYellow"
[[columns]]
kind = "Esp"
style = "BrightBlue"
[[columns]]
kind = "FileName"
style = "BrightBlue"
[[columns]]
kind = "Gid"
style = "White"
[[columns]]
kind = "GidFs"
style = "White"
[[columns]]
kind = "GidReal"
style = "White"
[[columns]]
kind = "GidSaved"
style = "White"
[[columns]]
kind = "Group"
style = "White"
[[columns]]
kind = "GroupFs"
style = "White"
[[columns]]
kind = "GroupReal"
style = "White"
[[columns]]
kind = "GroupSaved"
style = "White"
[[columns]]
kind = "MajFlt"
style = "BrightCyan"
[[columns]]
kind = "MinFlt"
style = "BrightWhite"
[[columns]]
kind = "MultiSlot"
style = "BrightWhite"
[[columns]]
kind = "Nice"
style = "Red"
[[columns]]
kind = "Pgid"
style = "Yellow"
[[columns]]
kind = "Pid"
style = "Green"
[[columns]]
kind = "Policy"
style = "Green"
[[columns]]
kind = "Ppid"
style = "Yellow"
[[columns]]
kind = "Priority"
style = "Blue"
[[columns]]
kind = "Processor"
style = "Magenta"
[[columns]]
kind = "ReadBytes"
style = "Cyan"
[[columns]]
kind = "RtPriority"
style = "White"
[[columns]]
kind = "SecContext"
style = "White"
[[columns]]
kind = "Separator"
style = "White"
[[columns]]
kind = "Session"
style = "Yellow"
[[columns]]
kind = "ShdPnd"
style = "White"
[[columns]]
kind = "SigBlk"
style = "White"
[[columns]]
kind = "SigCgt"
style = "White"
[[columns]]
kind = "SigIgn"
style = "White"
[[columns]]
kind = "SigPnd"
style = "White"
[[columns]]
kind = "Ssb"
style = "White"
[[columns]]
kind = "StartTime"
style = "White"
[[columns]]
kind = "State"
style = "White"
[[columns]]
kind = "TcpPort"
style = "White"
[[columns]]
kind = "Threads"
style = "White"
[[columns]]
kind = "TreeSlot"
style = "BrightWhite"
[[columns]]
kind = "Tty"
style = "White"
[[columns]]
kind = "UdpPort"
style = "White"
[[columns]]
kind = "Uid"
style = "White"
[[columns]]
kind = "UidFs"
style = "White"
[[columns]]
kind = "UidLogin"
style = "White"
[[columns]]
kind = "UidReal"
style = "White"
[[columns]]
kind = "UidSaved"
style = "White"
[[columns]]
kind = "UsageCpu"
style = "White"
[[columns]]
kind = "UsageMem"
style = "White"
[[columns]]
kind = "User"
style = "White"
[[columns]]
kind = "UserFs"
style = "White"
[[columns]]
kind = "UserLogin"
style = "White"
[[columns]]
kind = "UserReal"
style = "White"
[[columns]]
kind = "UserSaved"
style = "White"
[[columns]]
kind = "VmData"
style = "ByUnit"
[[columns]]
kind = "VmExe"
style = "ByUnit"
[[columns]]
kind = "VmHwm"
style = "ByUnit"
[[columns]]
kind = "VmLib"
style = "ByUnit"
[[columns]]
kind = "VmLock"
style = "ByUnit"
[[columns]]
kind = "VmPeak"
style = "ByUnit"
[[columns]]
kind = "VmPin"
style = "ByUnit"
[[columns]]
kind = "VmPte"
style = "ByUnit"
[[columns]]
kind = "VmRss"
style = "ByUnit"
[[columns]]
kind = "VmSize"
style = "ByUnit"
[[columns]]
kind = "VmStack"
style = "ByUnit"
[[columns]]
kind = "VmSwap"
style = "ByUnit"
[[columns]]
kind = "Wchan"
style = "White"
[[columns]]
kind = "WorkDir"
style = "White"
[[columns]]
kind = "WriteBytes"
style = "White"
"#;