-
Notifications
You must be signed in to change notification settings - Fork 0
/
bench.go
33 lines (27 loc) · 1.18 KB
/
bench.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package schema
import (
"fmt"
"go.mongodb.org/mongo-driver/bson/primitive"
"time"
)
type Bench struct {
NodeName string `bson:"node_name,omitempty"`
TargetIP_Port string `bson:"target_ip_port,omitempty"`
NetSpeedToS int32 `bson:"net_speed_to_s,omitempty"`
NetSpeedFromS int32 `bson:"net_speed_from_s,omitempty"`
RamTotal int64 `bson:"ram_usage,omitempty"`
RamUsed int64 `bson:"ram_used,omitempty"`
RamCached int64 `bson:"ram_cached,omitempty"`
RamFree int64 `bson:"ram_free,omitempty"`
CpuUser float64 `bson:"cpu_user,omitempty"`
CpuSystem float64 `bson:"cpu_system,omitempty"`
CpuIdle float64 `bson:"cpu_idle,omitempty"`
TimeStamp primitive.ObjectID `bson:"time_stamp,omitempty"`
}
/* God please for this function name! */
func Test_TimeToPrim() {
now := primitive.NewDateTimeFromTime((time.Now()))
nowObj := primitive.NewObjectIDFromTimestamp(time.Now())
fmt.Println("primitive.NewObjectIDFromTimestamp(time.Now()) ~~> ", nowObj)
fmt.Println("primitive.NewDateTimeFromTime((time.Now())) ~~> ", now)
}