Documentation ¶
Index ¶
- func BytesToGB(bytes uint64) float64
- func BytesToUnit(value uint64) string
- func ConstructJsonFieldDescription() map[string]string
- func ConvertBytes(bytes uint64, unit string) float64
- func ConvertBytesToUnit(bytes float64, unit string) float64
- func ConvertToMB(value string) (float64, error)
- func ConvertToReadableSize(bytes uint64) (float64, string)
- func ConvertToReadableUnit(value interface{}) string
- func DefaultFloatIfZero(val, def float64) float64
- func DefaultIfEmpty(val, def string) string
- func DefaultIntIfZero(val, def int) int
- func GetBasePath() string
- func GetCPULoad() (serviceCPU, systemCPU, totalCPU string)
- func GetDataRetentionPeriod() time.Duration
- func GetDirSize(folderPath string) string
- func GetMemoryLoad() (serviceMem, systemMem, totalMem string)
- func GetProcessDetails() (int32, *process.Process)
- func GetProcessId() int32
- func GetProcessObject() *process.Process
- func GetServiceInfo() models.ServiceInfo
- func GetServiceStartTime() time.Time
- func GetVirtualMemory() (*mem.VirtualMemoryStat, error)
- func ParseFloat64ToString(value float64) string
- func ParseStringToFloat64(value string) float64
- func ParseUint64ToFloat64(value uint64) float64
- func RoundFloat64(value float64, precision int) float64
- func SetServiceInfo(serviceName string, serviceStartTime time.Time, goVersion string, ...)
- type Cache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToUnit ¶
BytesToUnit converts a float64 value (representing bytes) to a human-readable unit (KB, MB, GB, TB) based on its magnitude
func ConstructJsonFieldDescription ¶
ConstructJsonFieldDescription reads the data from the JSON file.
func ConvertBytes ¶
ConvertBytes converts bytes to the specified unit.
func ConvertBytesToUnit ¶
ConvertBytesToUnit converts bytes to the specified unit and returns the result as a float64.
func ConvertToMB ¶ added in v0.0.2
Helper function to convert values to MB
func ConvertToReadableSize ¶
convertToReadableSize converts bytes into a more human-readable format (MB, GB).
func ConvertToReadableUnit ¶
func ConvertToReadableUnit(value interface{}) string
ConvertToReadableUnit converts the input value to a more human-readable unit.
func DefaultFloatIfZero ¶ added in v0.0.2
Helper function to set default float value
func DefaultIfEmpty ¶ added in v0.0.2
Helper function to set default string value
func DefaultIntIfZero ¶ added in v0.0.2
Helper function to set default integer value
func GetCPULoad ¶
func GetCPULoad() (serviceCPU, systemCPU, totalCPU string)
GetCPULoad calculates the CPU load for the service, system, and total.
func GetDataRetentionPeriod ¶
GetDataRetentionPeriod returns the retention period.
func GetDirSize ¶
GetDirSize returns the size of the directory.
func GetMemoryLoad ¶
func GetMemoryLoad() (serviceMem, systemMem, totalMem string)
GetMemoryLoad calculates the memory load for the service, system, and total.
func GetProcessDetails ¶
GetProcessDetails returns the process ID and process object.
func GetProcessObject ¶
GetProcessObject returns the process object.
func GetServiceInfo ¶
func GetServiceInfo() models.ServiceInfo
GetServiceInfo returns the service info.
func GetServiceStartTime ¶
GetServiceStartTime returns the service start time.
func GetVirtualMemory ¶
func GetVirtualMemory() (*mem.VirtualMemoryStat, error)
GetVirtualMemory returns the virtual memory statistics.
func ParseFloat64ToString ¶
ParseFloat64ToString converts float64 to string.
func ParseStringToFloat64 ¶
ParseStringToFloat64 converts string to float64.
func ParseUint64ToFloat64 ¶
ParseUint64ToFloat64 converts uint64 to float64.
func RoundFloat64 ¶
RoundFloat64 rounds the float64 value to the specified precision.
Types ¶
type Cache ¶ added in v0.0.2
Cache is the struct to store the cache data
func (*Cache) LoadFromFile ¶ added in v0.0.2
LoadFromFile loads the cache from a file, or starts fresh if the file does not exist or an error occurs
func (*Cache) SaveToFile ¶ added in v0.0.2
SaveToFile saves the cache to a file