|
@@ -4,8 +4,10 @@ import (
|
|
|
"fmt"
|
|
|
)
|
|
|
|
|
|
+const version = "0.0.1"
|
|
|
+
|
|
|
func Hello() string {
|
|
|
- return "Hello, world"
|
|
|
+ return fmt.Sprintf("Welcome to gupta version %s", version)
|
|
|
}
|
|
|
|
|
|
func Run(load, cpu, memory bool, partition, networkInterface string) (cpuLoad, cpuUsage, memoryUsage float64) {
|
|
@@ -24,3 +26,20 @@ type GuptaReport struct {
|
|
|
func (g *GuptaReport) GetCPULoad() string {
|
|
|
return fmt.Sprintf("%.2f", g.cpuLoad)
|
|
|
}
|
|
|
+
|
|
|
+type CPULoad struct {
|
|
|
+ user int
|
|
|
+ nice int
|
|
|
+ system int
|
|
|
+ idle int
|
|
|
+ iowait int
|
|
|
+ irq int
|
|
|
+ softirq int
|
|
|
+ steal int
|
|
|
+ guest int
|
|
|
+ guest_nice int
|
|
|
+}
|
|
|
+
|
|
|
+func (c *CPULoad) ReadInfo(rawInfo []string) {
|
|
|
+ c.user = 1
|
|
|
+}
|