Skip to content

Commit

Permalink
doc: Adding end user documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
RawanMostafa08 committed Sep 28, 2024
1 parent 1284b00 commit ecdf06f
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 6 deletions.
60 changes: 59 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,59 @@
# psutil-golang-RawanMostafa
# Psutils

This repository implements a human-friendly lib for querying processes, memory info and cpu info

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)


## Installation

Get the package

```bash
go get github.com/codescalersinternships/psutil-golang-RawanMostafa
```
Import the package

```go
import github.com/codescalersinternships/psutil-golang-RawanMostafa/pkg
```

## Usage

The psutils package offers different APIs like:

### 1. CPU related APIs

```go
cpuInfo, err := psutils.GetCpuInfo()
if err != nil {
//handle the error
}
```

### 2. Memory related APIs

```go
memInfo, err := psutils.GetMemInfo()
if err != nil {
//handle the error
}
```
### 3. Processes related APIs

1. ```go
procs, err := psutils.GetProcessList()
if err != nil {
//handle the error
}
```

2. ```go
procDetails, err := psutils.GetProcessDetails(1)
if err != nil {
//handle the error
}
```
13 changes: 8 additions & 5 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ import (

func main() {
cpuInfo, _ := psutils.GetCpuInfo()
log.Printf("%v",cpuInfo)
log.Printf("%v", cpuInfo)
memInfo, err := psutils.GetMemInfo()
log.Printf("%v",memInfo)
log.Printf("err %v",err)
log.Printf("%v", memInfo)
log.Printf("err %v", err)
procs, err := psutils.GetProcessList()
log.Printf("%v\n",procs)
log.Printf("err %v",err)
log.Printf("%v\n", procs)
log.Printf("err %v", err)
det, err := psutils.GetProcessDetails(1)
log.Printf("%v\n", det)
log.Printf("err %v", err)

}

0 comments on commit ecdf06f

Please sign in to comment.