@@ -6,7 +6,7 @@ use cgroups_rs::cpuacct::{CpuAcct, CpuAcctController};
66use cgroups_rs:: memory:: { MemController , MemSwap , Memory } ;
77use cgroups_rs:: pid:: PidController ;
88use cgroups_rs:: { Cgroup , CgroupPid , Controller , MaxValue } ;
9- use log:: { debug, error, warn} ;
9+ use log:: { debug, error, warn, info } ;
1010use nix:: sys:: resource:: { getrusage, UsageWho } ;
1111use nix:: sys:: time:: TimeVal ;
1212use nix:: unistd:: Pid ;
@@ -33,6 +33,15 @@ impl CatBoxCgroup {
3333 pub fn new ( option : & CatBoxOption , child : Pid ) -> Result < Self , CatBoxError > {
3434 let hierarchy = cgroups_rs:: hierarchies:: auto ( ) ;
3535
36+ info ! (
37+ "Support cgroup subsystems: {:?}" ,
38+ hierarchy
39+ . subsystems( )
40+ . iter( )
41+ . map( |subsystem| subsystem. controller_name( ) )
42+ . collect:: <Vec <String >>( )
43+ ) ;
44+
3645 let mut enable_cpuacct = hierarchy
3746 . subsystems ( )
3847 . iter ( )
@@ -53,7 +62,7 @@ impl CatBoxCgroup {
5362
5463 let cgroup_name = format ! ( "{}/{}.{}" , option. cgroup( ) , option. cgroup( ) , child. as_raw( ) ) ;
5564
56- debug ! ( "Init cgroup {}" , cgroup_name) ;
65+ info ! ( "Start initializing cgroup {}" , cgroup_name) ;
5766
5867 let builder = CgroupBuilder :: new ( cgroup_name. as_str ( ) ) ;
5968 let builder = if enable_memory {
@@ -159,6 +168,8 @@ impl CatBoxCgroup {
159168 }
160169 }
161170
171+ info ! ( "Finish initializing cgroup {}" , cgroup_name) ;
172+
162173 // 默认回退到不使用 cgroup,force 模式下报错
163174 if !enable_cpuacct {
164175 if option. force ( ) {
0 commit comments