Documentation ¶
Overview ¶
-------------------------------------------------------------------------
* * cpu.go * Read process cpu info in procfs * * * Copyright (c) 2021, Alibaba Group Holding Limited * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * IDENTIFICATION * common/system/cpu.go *-------------------------------------------------------------------------
-------------------------------------------------------------------------
* * disk.go * Read process disk info in procfs * * * Copyright (c) 2021, Alibaba Group Holding Limited * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * IDENTIFICATION * common/system/disk.go *-------------------------------------------------------------------------
-------------------------------------------------------------------------
* * io.go * Read process io info in procfs * * * Copyright (c) 2021, Alibaba Group Holding Limited * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * IDENTIFICATION * common/system/io.go *-------------------------------------------------------------------------
-------------------------------------------------------------------------
* * mem.go * Read process mem info in procfs * * * Copyright (c) 2021, Alibaba Group Holding Limited * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * IDENTIFICATION * common/system/mem.go *-------------------------------------------------------------------------
-------------------------------------------------------------------------
* * system.go * Read process other info in procfs * * * Copyright (c) 2021, Alibaba Group Holding Limited * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * IDENTIFICATION * common/system/system.go *-------------------------------------------------------------------------
Index ¶
- func DeletedFilesSize(port int, pidsMap *sync.Map) (int64, int64, uint32, error)
- func DirSize(path string) (int64, int64, error)
- func FilteredDirSize(path, regex string) (int64, int64, error)
- func GetBinName(path string, buf []byte, stat *ProcessStat) error
- func GetCPUCount() (int64, error)
- func GetClkTck() (int64, error)
- func GetCmdLine(path string, buf *bytes.Buffer, stat *ProcessStat, fp *os.File) (*os.File, error)
- func GetHostname() string
- func GetIP() string
- func GetPageSize() (int64, error)
- func GetPid(port int, pidFile string) (pid uint32, err error)
- func GetSysconf(scID int) (int64, error)
- func ReadFile(filename string, buf *bytes.Buffer, fp *os.File) (*os.File, error)
- func ReadIOStat(path string, buf *bytes.Buffer, stat *IOStat, fp *os.File) (*os.File, error)
- func ReadMemStat(path string, buf *bytes.Buffer, stat *MemoryStat, fp *os.File) (*os.File, error)
- func ReadProcessStat(path string, buf *bytes.Buffer, stat *ProcessStat, fp *os.File) (*os.File, error)
- func ValidPid(pid uint32, pattern string) bool
- type Cpu
- type IO
- type IOStat
- type Mem
- type MemoryStat
- type ProcessStat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeletedFilesSize ¶
func DirSize ¶
DirSizeExcludeHardLink calculate the file size one by one(hard link only calculate once) and return file count also
func FilteredDirSize ¶
DirSize calculate the file size one by one and return file count also
func GetBinName ¶
func GetBinName(path string, buf []byte, stat *ProcessStat) error
GetBinName get binary name, is kernel ""
func GetClkTck ¶
GetClkTck return the system clock ticks this will return the same as C.sysconf(C._SC_CLK_TCK)
func GetCmdLine ¶
GetCmdLine get cmdline, if kernel cmd
func GetPageSize ¶
GetPageSize return the pagesize on this machine
func GetSysconf ¶
GetSysconf return the sysconf value associated with th scID
func ReadIOStat ¶
ReadIOStat read statm from /proc/pid/io
func ReadMemStat ¶
ReadMemStat read statm from /proc/pid/statm
Types ¶
type Cpu ¶
type Cpu struct { ClkTck int64 Stat *ProcessStat // contains filtered or unexported fields }
func (*Cpu) CpuStatByPid ¶
CpuStatByPid get process stat by pid
func (*Cpu) ThreadCpuStat ¶
type IO ¶
type IO struct { Stat *IOStat // contains filtered or unexported fields }
func (*IO) IOStatByPid ¶
type Mem ¶
type Mem struct { PageSize uint64 Stat *MemoryStat // contains filtered or unexported fields }
Mem the memory size in bytes