func (protoSerializer) Marshal(stats map[int32]*procutil.StatsWithPerm) ([]byte, error) {
	payload := &model.ProcStatsWithPermByPID{
		StatsByPID: make(map[int32]*model.ProcStatsWithPerm),
	}
	for pid, s := range stats {
		stat := statPool.Get().(*model.ProcStatsWithPerm)
		stat.OpenFDCount = s.OpenFdCount
		stat.ReadCount = s.IOStat.ReadCount
		stat.WriteCount = s.IOStat.WriteCount
		stat.ReadBytes = s.IOStat.ReadBytes
		stat.WriteBytes = s.IOStat.WriteBytes
		payload.StatsByPID[pid] = stat
	}

	buf, err := proto.Marshal(payload)
	returnToPool(payload.StatsByPID)
	return buf, err
}
// Marshal serializes stats by PID into bytes
Marshal serializes stats by PID into bytes
// Marshal serializes stats by PID into bytes
func (protoSerializer) Marshal(stats map[int32]*procutil.StatsWithPerm) ([]byte, error) {
	payload := &model.ProcStatsWithPermByPID{
		StatsByPID: make(map[int32]*model.ProcStatsWithPerm),
	}
	for pid, s := range stats {
		stat := statPool.Get().(*model.ProcStatsWithPerm)
		stat.OpenFDCount = s.OpenFdCount
		stat.ReadCount = s.IOStat.ReadCount
		stat.WriteCount = s.IOStat.WriteCount
		stat.ReadBytes = s.IOStat.ReadBytes
		stat.WriteBytes = s.IOStat.WriteBytes
		payload.StatsByPID[pid] = stat
	}
	buf, err := proto.Marshal(payload)
	returnToPool(payload.StatsByPID)
	return buf, err
}
func ( protoSerializer ) Marshal ( stats map [ int32 ] * procutil . StatsWithPerm ) ( [ ] byte , error ) { payload := & model . ProcStatsWithPermByPID { StatsByPID : make ( map [ int32 ] * model . ProcStatsWithPerm ) , } for pid , s := range stats { stat := statPool . Get ( ) . ( * model . ProcStatsWithPerm ) stat . OpenFDCount = s . OpenFdCount stat . ReadCount = s . IOStat . ReadCount stat . WriteCount = s . IOStat . WriteCount stat . ReadBytes = s . IOStat . ReadBytes stat . WriteBytes = s . IOStat . WriteBytes payload . StatsByPID [ pid ] = stat } buf , err := proto . Marshal ( payload ) returnToPool ( payload . StatsByPID ) return buf , err }
Marshal serializes stats by PID into bytes
Marshal serializes stats by PID into bytes