utils

package
v0.0.0-...-024e838 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFile

func CreateFile(path string) (file *os.File, err error)

CreateFile creates a file and returns its reference to work with it

func FileExists

func FileExists(filename string) bool

FileExists returns true if the file trully exists in the system, else return false

func IsValidFile

func IsValidFile(file string) bool

IsValidFile verify if the file extension is valid

func ReadFile

func ReadFile(path string) (string, error)

ReadFile open the gived file and returns it to work with it

func SaveProcecess

func SaveProcecess(procecess []*FakeProcess) (okay bool)

SaveProcecess saves all the procecess in a file to use the information later

Types

type FakeProcess

type FakeProcess struct {
	Pid      int32
	Name     string
	Status   string // Status returns the process status. Return value could be one of these. R: Running S: Sleep T: Stop I: Idle Z: Zombie W: Wait L: Lock The character is same within all supported platforms.
	User     string
	CPU      float64
	Memory   float32
	Priority int32
}

FakeProcess contains the information about trully procecess only to simulate the procecess functionality

func GetProcecess

func GetProcecess() (fakeProcecess []*FakeProcess)

GetProcecess returns all the procecess information fromthe system to simulate the functionality

func ReadProcecess

func ReadProcecess(path string) (procecess []*FakeProcess)

ReadProcecess reads the procecess information stored in a csv file and puts them in a slice of *FakeProcess

func (*FakeProcess) ToArray

func (proc *FakeProcess) ToArray() []string

ToArray converts the process information to an array to process the information

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL