podman

Форк
0
764 строки · 23.5 Кб
1
// +build aix
2

3
package perfstat
4

5
/*
6
#cgo LDFLAGS: -lperfstat
7

8
#include <libperfstat.h>
9
#include <sys/proc.h>
10

11
#include "c_helpers.h"
12
*/
13
import "C"
14

15
func perfstatcpu2cpu(n *C.perfstat_cpu_t) CPU {
16
	var c CPU
17
	c.Name = C.GoString(&n.name[0])
18
	c.User = int64(n.user)
19
	c.Sys = int64(n.sys)
20
	c.Idle = int64(n.idle)
21
	c.Wait = int64(n.wait)
22
	c.PSwitch = int64(n.pswitch)
23
	c.Syscall = int64(n.syscall)
24
	c.Sysread = int64(n.sysread)
25
	c.Syswrite = int64(n.syswrite)
26
	c.Sysfork = int64(n.sysfork)
27
	c.Sysexec = int64(n.sysexec)
28
	c.Readch = int64(n.readch)
29
	c.Writech = int64(n.writech)
30
	c.Bread = int64(n.bread)
31
	c.Bwrite = int64(n.bwrite)
32
	c.Lread = int64(n.lread)
33
	c.Lwrite = int64(n.lwrite)
34
	c.Phread = int64(n.phread)
35
	c.Phwrite = int64(n.phwrite)
36
	c.Iget = int64(n.iget)
37
	c.Namei = int64(n.namei)
38
	c.Dirblk = int64(n.dirblk)
39
	c.Msg = int64(n.msg)
40
	c.Sema = int64(n.sema)
41
	c.MinFaults = int64(n.minfaults)
42
	c.MajFaults = int64(n.majfaults)
43
	c.PUser = int64(n.puser)
44
	c.PSys = int64(n.psys)
45
	c.PIdle = int64(n.pidle)
46
	c.PWait = int64(n.pwait)
47
	c.RedispSD0 = int64(n.redisp_sd0)
48
	c.RedispSD1 = int64(n.redisp_sd1)
49
	c.RedispSD2 = int64(n.redisp_sd2)
50
	c.RedispSD3 = int64(n.redisp_sd3)
51
	c.RedispSD4 = int64(n.redisp_sd4)
52
	c.RedispSD5 = int64(n.redisp_sd5)
53
	c.MigrationPush = int64(n.migration_push)
54
	c.MigrationS3grq = int64(n.migration_S3grq)
55
	c.MigrationS3pul = int64(n.migration_S3pul)
56
	c.InvolCSwitch = int64(n.invol_cswitch)
57
	c.VolCSwitch = int64(n.vol_cswitch)
58
	c.RunQueue = int64(n.runque)
59
	c.Bound = int64(n.bound)
60
	c.DecrIntrs = int64(n.decrintrs)
61
	c.MpcRIntrs = int64(n.mpcrintrs)
62
	c.MpcSIntrs = int64(n.mpcsintrs)
63
	c.SoftIntrs = int64(n.softintrs)
64
	c.DevIntrs = int64(n.devintrs)
65
	c.PhantIntrs = int64(n.phantintrs)
66
	c.IdleDonatedPurr = int64(n.idle_donated_purr)
67
	c.IdleDonatedSpurr = int64(n.idle_donated_spurr)
68
	c.BusyDonatedPurr = int64(n.busy_donated_purr)
69
	c.BusyDonatedSpurr = int64(n.busy_donated_spurr)
70
	c.IdleStolenPurr = int64(n.idle_stolen_purr)
71
	c.IdleStolenSpurr = int64(n.idle_stolen_spurr)
72
	c.BusyStolenPurr = int64(n.busy_stolen_purr)
73
	c.BusyStolenSpurr = int64(n.busy_stolen_spurr)
74
	c.Hpi = int64(n.hpi)
75
	c.Hpit = int64(n.hpit)
76
	c.PUserSpurr = int64(n.puser_spurr)
77
	c.PSysSpurr = int64(n.psys_spurr)
78
	c.PIdleSpurr = int64(n.pidle_spurr)
79
	c.PWaitSpurr = int64(n.pwait_spurr)
80
	c.SpurrFlag = int32(n.spurrflag)
81
	c.LocalDispatch = int64(n.localdispatch)
82
	c.NearDispatch = int64(n.neardispatch)
83
	c.FarDispatch = int64(n.fardispatch)
84
	c.CSwitches = int64(n.cswitches)
85
	c.Version = int64(n.version)
86
	c.TbLast = int64(n.tb_last)
87
	c.State = int(n.state)
88
	c.VtbLast = int64(n.vtb_last)
89
	c.ICountLast = int64(n.icount_last)
90
	return c
91
}
92

93
func perfstatcputotal2cputotal(n *C.perfstat_cpu_total_t) CPUTotal {
94
	var c CPUTotal
95
	c.NCpus = int(n.ncpus)
96
	c.NCpusCfg = int(n.ncpus_cfg)
97
	c.Description = C.GoString(&n.description[0])
98
	c.ProcessorHz = int64(n.processorHZ)
99
	c.User = int64(n.user)
100
	c.Sys = int64(n.sys)
101
	c.Idle = int64(n.idle)
102
	c.Wait = int64(n.wait)
103
	c.PSwitch = int64(n.pswitch)
104
	c.Syscall = int64(n.syscall)
105
	c.Sysread = int64(n.sysread)
106
	c.Syswrite = int64(n.syswrite)
107
	c.Sysfork = int64(n.sysfork)
108
	c.Sysexec = int64(n.sysexec)
109
	c.Readch = int64(n.readch)
110
	c.Writech = int64(n.writech)
111
	c.DevIntrs = int64(n.devintrs)
112
	c.SoftIntrs = int64(n.softintrs)
113
	c.Lbolt = int64(n.lbolt)
114
	c.LoadAvg1 = (float32(n.loadavg[0]) / (1 << C.SBITS))
115
	c.LoadAvg5 = (float32(n.loadavg[1]) / (1 << C.SBITS))
116
	c.LoadAvg15 = (float32(n.loadavg[2]) / (1 << C.SBITS))
117
	c.RunQueue = int64(n.runque)
118
	c.SwpQueue = int64(n.swpque)
119
	c.Bread = int64(n.bread)
120
	c.Bwrite = int64(n.bwrite)
121
	c.Lread = int64(n.lread)
122
	c.Lwrite = int64(n.lwrite)
123
	c.Phread = int64(n.phread)
124
	c.Phwrite = int64(n.phwrite)
125
	c.RunOcc = int64(n.runocc)
126
	c.SwpOcc = int64(n.swpocc)
127
	c.Iget = int64(n.iget)
128
	c.Namei = int64(n.namei)
129
	c.Dirblk = int64(n.dirblk)
130
	c.Msg = int64(n.msg)
131
	c.Sema = int64(n.sema)
132
	c.RcvInt = int64(n.rcvint)
133
	c.XmtInt = int64(n.xmtint)
134
	c.MdmInt = int64(n.mdmint)
135
	c.TtyRawInch = int64(n.tty_rawinch)
136
	c.TtyCanInch = int64(n.tty_caninch)
137
	c.TtyRawOutch = int64(n.tty_rawoutch)
138
	c.Ksched = int64(n.ksched)
139
	c.Koverf = int64(n.koverf)
140
	c.Kexit = int64(n.kexit)
141
	c.Rbread = int64(n.rbread)
142
	c.Rcread = int64(n.rcread)
143
	c.Rbwrt = int64(n.rbwrt)
144
	c.Rcwrt = int64(n.rcwrt)
145
	c.Traps = int64(n.traps)
146
	c.NCpusHigh = int64(n.ncpus_high)
147
	c.PUser = int64(n.puser)
148
	c.PSys = int64(n.psys)
149
	c.PIdle = int64(n.pidle)
150
	c.PWait = int64(n.pwait)
151
	c.DecrIntrs = int64(n.decrintrs)
152
	c.MpcRIntrs = int64(n.mpcrintrs)
153
	c.MpcSIntrs = int64(n.mpcsintrs)
154
	c.PhantIntrs = int64(n.phantintrs)
155
	c.IdleDonatedPurr = int64(n.idle_donated_purr)
156
	c.IdleDonatedSpurr = int64(n.idle_donated_spurr)
157
	c.BusyDonatedPurr = int64(n.busy_donated_purr)
158
	c.BusyDonatedSpurr = int64(n.busy_donated_spurr)
159
	c.IdleStolenPurr = int64(n.idle_stolen_purr)
160
	c.IdleStolenSpurr = int64(n.idle_stolen_spurr)
161
	c.BusyStolenPurr = int64(n.busy_stolen_purr)
162
	c.BusyStolenSpurr = int64(n.busy_stolen_spurr)
163
	c.IOWait = int32(n.iowait)
164
	c.PhysIO = int32(n.physio)
165
	c.TWait = int64(n.twait)
166
	c.Hpi = int64(n.hpi)
167
	c.Hpit = int64(n.hpit)
168
	c.PUserSpurr = int64(n.puser_spurr)
169
	c.PSysSpurr = int64(n.psys_spurr)
170
	c.PIdleSpurr = int64(n.pidle_spurr)
171
	c.PWaitSpurr = int64(n.pwait_spurr)
172
	c.SpurrFlag = int(n.spurrflag)
173
	c.Version = int64(n.version)
174
	c.TbLast = int64(n.tb_last)
175
	c.PurrCoalescing = int64(n.purr_coalescing)
176
	c.SpurrCoalescing = int64(n.spurr_coalescing)
177
	return c
178
}
179

180
func perfstatcpuutil2cpuutil(n *C.perfstat_cpu_util_t) CPUUtil {
181
	var c CPUUtil
182

183
	c.Version = int64(n.version)
184
	c.CpuID = C.GoString(&n.cpu_id[0])
185
	c.Entitlement = float32(n.entitlement)
186
	c.UserPct = float32(n.user_pct)
187
	c.KernPct = float32(n.kern_pct)
188
	c.IdlePct = float32(n.idle_pct)
189
	c.WaitPct = float32(n.wait_pct)
190
	c.PhysicalBusy = float32(n.physical_busy)
191
	c.PhysicalConsumed = float32(n.physical_consumed)
192
	c.FreqPct = float32(n.freq_pct)
193
	c.EntitlementPct = float32(n.entitlement_pct)
194
	c.BusyPct = float32(n.busy_pct)
195
	c.IdleDonatedPct = float32(n.idle_donated_pct)
196
	c.BusyDonatedPct = float32(n.busy_donated_pct)
197
	c.IdleStolenPct = float32(n.idle_stolen_pct)
198
	c.BusyStolenPct = float32(n.busy_stolen_pct)
199
	c.LUserPct = float32(n.l_user_pct)
200
	c.LKernPct = float32(n.l_kern_pct)
201
	c.LIdlePct = float32(n.l_idle_pct)
202
	c.LWaitPct = float32(n.l_wait_pct)
203
	c.DeltaTime = int64(n.delta_time)
204

205
	return c
206
}
207

208
func perfstatdisktotal2disktotal(n C.perfstat_disk_total_t) DiskTotal {
209
	var d DiskTotal
210

211
	d.Number = int32(n.number)
212
	d.Size = int64(n.size)
213
	d.Free = int64(n.free)
214
	d.XRate = int64(n.xrate)
215
	d.Xfers = int64(n.xfers)
216
	d.Wblks = int64(n.wblks)
217
	d.Rblks = int64(n.rblks)
218
	d.Time = int64(n.time)
219
	d.Version = int64(n.version)
220
	d.Rserv = int64(n.rserv)
221
	d.MinRserv = int64(n.min_rserv)
222
	d.MaxRserv = int64(n.max_rserv)
223
	d.RTimeOut = int64(n.rtimeout)
224
	d.RFailed = int64(n.rfailed)
225
	d.Wserv = int64(n.wserv)
226
	d.MinWserv = int64(n.min_wserv)
227
	d.MaxWserv = int64(n.max_wserv)
228
	d.WTimeOut = int64(n.wtimeout)
229
	d.WFailed = int64(n.wfailed)
230
	d.WqDepth = int64(n.wq_depth)
231
	d.WqTime = int64(n.wq_time)
232
	d.WqMinTime = int64(n.wq_min_time)
233
	d.WqMaxTime = int64(n.wq_max_time)
234

235
	return d
236
}
237

238
func perfstatdiskadapter2diskadapter(n *C.perfstat_diskadapter_t) DiskAdapter {
239
	var d DiskAdapter
240

241
	d.Name = C.GoString(&n.name[0])
242
	d.Description = C.GoString(&n.description[0])
243
	d.Number = int32(n.number)
244
	d.Size = int64(n.size)
245
	d.Free = int64(n.free)
246
	d.XRate = int64(n.xrate)
247
	d.Xfers = int64(n.xfers)
248
	d.Rblks = int64(n.rblks)
249
	d.Wblks = int64(n.wblks)
250
	d.Time = int64(n.time)
251
	d.Version = int64(n.version)
252
	d.AdapterType = int64(n.adapter_type)
253
	d.DkBSize = int64(n.dk_bsize)
254
	d.DkRserv = int64(n.dk_rserv)
255
	d.DkWserv = int64(n.dk_wserv)
256
	d.MinRserv = int64(n.min_rserv)
257
	d.MaxRserv = int64(n.max_rserv)
258
	d.MinWserv = int64(n.min_wserv)
259
	d.MaxWserv = int64(n.max_wserv)
260
	d.WqDepth = int64(n.wq_depth)
261
	d.WqSampled = int64(n.wq_sampled)
262
	d.WqTime = int64(n.wq_time)
263
	d.WqMinTime = int64(n.wq_min_time)
264
	d.WqMaxTime = int64(n.wq_max_time)
265
	d.QFull = int64(n.q_full)
266
	d.QSampled = int64(n.q_sampled)
267

268
	return d
269
}
270

271
func perfstatpartitionconfig2partitionconfig(n C.perfstat_partition_config_t) PartitionConfig {
272
	var p PartitionConfig
273
	p.Version = int64(n.version)
274
	p.Name = C.GoString(&n.partitionname[0])
275
	p.Node = C.GoString(&n.nodename[0])
276
	p.Conf.SmtCapable = (n.conf[0] & (1 << 7)) > 0
277
	p.Conf.SmtEnabled = (n.conf[0] & (1 << 6)) > 0
278
	p.Conf.LparCapable = (n.conf[0] & (1 << 5)) > 0
279
	p.Conf.LparEnabled = (n.conf[0] & (1 << 4)) > 0
280
	p.Conf.SharedCapable = (n.conf[0] & (1 << 3)) > 0
281
	p.Conf.SharedEnabled = (n.conf[0] & (1 << 2)) > 0
282
	p.Conf.DLparCapable = (n.conf[0] & (1 << 1)) > 0
283
	p.Conf.Capped = (n.conf[0] & (1 << 0)) > 0
284
	p.Conf.Kernel64bit = (n.conf[1] & (1 << 7)) > 0
285
	p.Conf.PoolUtilAuthority = (n.conf[1] & (1 << 6)) > 0
286
	p.Conf.DonateCapable = (n.conf[1] & (1 << 5)) > 0
287
	p.Conf.DonateEnabled = (n.conf[1] & (1 << 4)) > 0
288
	p.Conf.AmsCapable = (n.conf[1] & (1 << 3)) > 0
289
	p.Conf.AmsEnabled = (n.conf[1] & (1 << 2)) > 0
290
	p.Conf.PowerSave = (n.conf[1] & (1 << 1)) > 0
291
	p.Conf.AmeEnabled = (n.conf[1] & (1 << 0)) > 0
292
	p.Conf.SharedExtended = (n.conf[2] & (1 << 7)) > 0
293
	p.Number = int32(n.partitionnum)
294
	p.GroupID = int32(n.groupid)
295
	p.ProcessorFamily = C.GoString(&n.processorFamily[0])
296
	p.ProcessorModel = C.GoString(&n.processorModel[0])
297
	p.MachineID = C.GoString(&n.machineID[0])
298
	p.ProcessorMhz = float64(C.get_partition_mhz(n))
299
	p.NumProcessors.Online = int64(n.numProcessors.online)
300
	p.NumProcessors.Max = int64(n.numProcessors.max)
301
	p.NumProcessors.Min = int64(n.numProcessors.min)
302
	p.NumProcessors.Desired = int64(n.numProcessors.desired)
303
	p.OSName = C.GoString(&n.OSName[0])
304
	p.OSVersion = C.GoString(&n.OSVersion[0])
305
	p.OSBuild = C.GoString(&n.OSBuild[0])
306
	p.LCpus = int32(n.lcpus)
307
	p.SmtThreads = int32(n.smtthreads)
308
	p.Drives = int32(n.drives)
309
	p.NetworkAdapters = int32(n.nw_adapters)
310
	p.CpuCap.Online = int64(n.cpucap.online)
311
	p.CpuCap.Max = int64(n.cpucap.max)
312
	p.CpuCap.Min = int64(n.cpucap.min)
313
	p.CpuCap.Desired = int64(n.cpucap.desired)
314
	p.Weightage = int32(n.cpucap_weightage)
315
	p.EntCapacity = int32(n.entitled_proc_capacity)
316
	p.VCpus.Online = int64(n.vcpus.online)
317
	p.VCpus.Max = int64(n.vcpus.max)
318
	p.VCpus.Min = int64(n.vcpus.min)
319
	p.VCpus.Desired = int64(n.vcpus.desired)
320
	p.PoolID = int32(n.processor_poolid)
321
	p.ActiveCpusInPool = int32(n.activecpusinpool)
322
	p.PoolWeightage = int32(n.cpupool_weightage)
323
	p.SharedPCpu = int32(n.sharedpcpu)
324
	p.MaxPoolCap = int32(n.maxpoolcap)
325
	p.EntPoolCap = int32(n.entpoolcap)
326
	p.Mem.Online = int64(n.mem.online)
327
	p.Mem.Max = int64(n.mem.max)
328
	p.Mem.Min = int64(n.mem.min)
329
	p.Mem.Desired = int64(n.mem.desired)
330
	p.MemWeightage = int32(n.mem_weightage)
331
	p.TotalIOMemoryEntitlement = int64(n.totiomement)
332
	p.MemPoolID = int32(n.mempoolid)
333
	p.HyperPgSize = int64(n.hyperpgsize)
334
	p.ExpMem.Online = int64(n.exp_mem.online)
335
	p.ExpMem.Max = int64(n.exp_mem.max)
336
	p.ExpMem.Min = int64(n.exp_mem.min)
337
	p.ExpMem.Desired = int64(n.exp_mem.desired)
338
	p.TargetMemExpFactor = int64(n.targetmemexpfactor)
339
	p.TargetMemExpSize = int64(n.targetmemexpsize)
340
	p.SubProcessorMode = int32(n.subprocessor_mode)
341
	return p
342
}
343

344
func perfstatmemorytotal2memorytotal(n C.perfstat_memory_total_t) MemoryTotal {
345
	var m MemoryTotal
346
	m.VirtualTotal = int64(n.virt_total)
347
	m.RealTotal = int64(n.real_total)
348
	m.RealFree = int64(n.real_free)
349
	m.RealPinned = int64(n.real_pinned)
350
	m.RealInUse = int64(n.real_inuse)
351
	m.BadPages = int64(n.pgbad)
352
	m.PageFaults = int64(n.pgexct)
353
	m.PageIn = int64(n.pgins)
354
	m.PageOut = int64(n.pgouts)
355
	m.PgSpIn = int64(n.pgspins)
356
	m.PgSpOut = int64(n.pgspouts)
357
	m.Scans = int64(n.scans)
358
	m.Cycles = int64(n.cycles)
359
	m.PgSteals = int64(n.pgsteals)
360
	m.NumPerm = int64(n.numperm)
361
	m.PgSpTotal = int64(n.pgsp_total)
362
	m.PgSpFree = int64(n.pgsp_free)
363
	m.PgSpRsvd = int64(n.pgsp_rsvd)
364
	m.RealSystem = int64(n.real_system)
365
	m.RealUser = int64(n.real_user)
366
	m.RealProcess = int64(n.real_process)
367
	m.VirtualActive = int64(n.virt_active)
368
	m.IOME = int64(n.iome)
369
	m.IOMU = int64(n.iomu)
370
	m.IOHWM = int64(n.iohwm)
371
	m.PMem = int64(n.pmem)
372
	m.CompressedTotal = int64(n.comprsd_total)
373
	m.CompressedWSegPg = int64(n.comprsd_wseg_pgs)
374
	m.CPgIn = int64(n.cpgins)
375
	m.CPgOut = int64(n.cpgouts)
376
	m.TrueSize = int64(n.true_size)
377
	m.ExpandedMemory = int64(n.expanded_memory)
378
	m.CompressedWSegSize = int64(n.comprsd_wseg_size)
379
	m.TargetCPoolSize = int64(n.target_cpool_size)
380
	m.MaxCPoolSize = int64(n.max_cpool_size)
381
	m.MinUCPoolSize = int64(n.min_ucpool_size)
382
	m.CPoolSize = int64(n.cpool_size)
383
	m.UCPoolSize = int64(n.ucpool_size)
384
	m.CPoolInUse = int64(n.cpool_inuse)
385
	m.UCPoolInUse = int64(n.ucpool_inuse)
386
	m.Version = int64(n.version)
387
	m.RealAvailable = int64(n.real_avail)
388
	m.BytesCoalesced = int64(n.bytes_coalesced)
389
	m.BytesCoalescedMemPool = int64(n.bytes_coalesced_mempool)
390

391
	return m
392
}
393

394
func perfstatnetinterfacetotal2netifacetotal(n C.perfstat_netinterface_total_t) NetIfaceTotal {
395
	var i NetIfaceTotal
396

397
	i.Number = int32(n.number)
398
	i.IPackets = int64(n.ipackets)
399
	i.IBytes = int64(n.ibytes)
400
	i.IErrors = int64(n.ierrors)
401
	i.OPackets = int64(n.opackets)
402
	i.OBytes = int64(n.obytes)
403
	i.OErrors = int64(n.oerrors)
404
	i.Collisions = int64(n.collisions)
405
	i.XmitDrops = int64(n.xmitdrops)
406
	i.Version = int64(n.version)
407

408
	return i
409
}
410

411
func perfstatdisk2disk(n *C.perfstat_disk_t) Disk {
412
	var d Disk
413

414
	d.Name = C.GoString(&n.name[0])
415
	d.Description = C.GoString(&n.description[0])
416
	d.VGName = C.GoString(&n.vgname[0])
417
	d.Size = int64(n.size)
418
	d.Free = int64(n.free)
419
	d.BSize = int64(n.bsize)
420
	d.XRate = int64(n.xrate)
421
	d.Xfers = int64(n.xfers)
422
	d.Wblks = int64(n.wblks)
423
	d.Rblks = int64(n.rblks)
424
	d.QDepth = int64(n.qdepth)
425
	d.Time = int64(n.time)
426
	d.Adapter = C.GoString(&n.adapter[0])
427
	d.PathsCount = int32(n.paths_count)
428
	d.QFull = int64(n.q_full)
429
	d.Rserv = int64(n.rserv)
430
	d.RTimeOut = int64(n.rtimeout)
431
	d.Rfailed = int64(n.rfailed)
432
	d.MinRserv = int64(n.min_rserv)
433
	d.MaxRserv = int64(n.max_rserv)
434
	d.Wserv = int64(n.wserv)
435
	d.WTimeOut = int64(n.wtimeout)
436
	d.Wfailed = int64(n.wfailed)
437
	d.MinWserv = int64(n.min_wserv)
438
	d.MaxWserv = int64(n.max_wserv)
439
	d.WqDepth = int64(n.wq_depth)
440
	d.WqSampled = int64(n.wq_sampled)
441
	d.WqTime = int64(n.wq_time)
442
	d.WqMinTime = int64(n.wq_min_time)
443
	d.WqMaxTime = int64(n.wq_max_time)
444
	d.QSampled = int64(n.q_sampled)
445
	d.Version = int64(n.version)
446
	d.PseudoDisk = (n.dk_type[0] & (1 << 7)) > 0
447
	d.VTDisk = (n.dk_type[0] & (1 << 6)) > 0
448

449
	return d
450
}
451

452
func perfstatdiskpath2diskpath(n *C.perfstat_diskpath_t) DiskPath {
453
	var d DiskPath
454

455
	d.Name = C.GoString(&n.name[0])
456
	d.XRate = int64(n.xrate)
457
	d.Xfers = int64(n.xfers)
458
	d.Rblks = int64(n.rblks)
459
	d.Wblks = int64(n.wblks)
460
	d.Time = int64(n.time)
461
	d.Adapter = C.GoString(&n.adapter[0])
462
	d.QFull = int64(n.q_full)
463
	d.Rserv = int64(n.rserv)
464
	d.RTimeOut = int64(n.rtimeout)
465
	d.Rfailed = int64(n.rfailed)
466
	d.MinRserv = int64(n.min_rserv)
467
	d.MaxRserv = int64(n.max_rserv)
468
	d.Wserv = int64(n.wserv)
469
	d.WTimeOut = int64(n.wtimeout)
470
	d.Wfailed = int64(n.wfailed)
471
	d.MinWserv = int64(n.min_wserv)
472
	d.MaxWserv = int64(n.max_wserv)
473
	d.WqDepth = int64(n.wq_depth)
474
	d.WqSampled = int64(n.wq_sampled)
475
	d.WqTime = int64(n.wq_time)
476
	d.WqMinTime = int64(n.wq_min_time)
477
	d.WqMaxTime = int64(n.wq_max_time)
478
	d.QSampled = int64(n.q_sampled)
479
	d.Version = int64(n.version)
480

481
	return d
482
}
483

484
func perfstatfcstat2fcadapter(n *C.perfstat_fcstat_t) FCAdapter {
485
	var f FCAdapter
486

487
	f.Version = int64(n.version)
488
	f.Name = C.GoString(&n.name[0])
489
	f.State = int32(n.state)
490
	f.InputRequests = int64(n.InputRequests)
491
	f.OutputRequests = int64(n.OutputRequests)
492
	f.InputBytes = int64(n.InputBytes)
493
	f.OutputBytes = int64(n.OutputBytes)
494
	f.EffMaxTransfer = int64(n.EffMaxTransfer)
495
	f.NoDMAResourceCnt = int64(n.NoDMAResourceCnt)
496
	f.NoCmdResourceCnt = int64(n.NoCmdResourceCnt)
497
	f.AttentionType = int32(n.AttentionType)
498
	f.SecondsSinceLastReset = int64(n.SecondsSinceLastReset)
499
	f.TxFrames = int64(n.TxFrames)
500
	f.TxWords = int64(n.TxWords)
501
	f.RxFrames = int64(n.RxFrames)
502
	f.RxWords = int64(n.RxWords)
503
	f.LIPCount = int64(n.LIPCount)
504
	f.NOSCount = int64(n.NOSCount)
505
	f.ErrorFrames = int64(n.ErrorFrames)
506
	f.DumpedFrames = int64(n.DumpedFrames)
507
	f.LinkFailureCount = int64(n.LinkFailureCount)
508
	f.LossofSyncCount = int64(n.LossofSyncCount)
509
	f.LossofSignal = int64(n.LossofSignal)
510
	f.PrimitiveSeqProtocolErrCount = int64(n.PrimitiveSeqProtocolErrCount)
511
	f.InvalidTxWordCount = int64(n.InvalidTxWordCount)
512
	f.InvalidCRCCount = int64(n.InvalidCRCCount)
513
	f.PortFcId = int64(n.PortFcId)
514
	f.PortSpeed = int64(n.PortSpeed)
515
	f.PortType = C.GoString(&n.PortType[0])
516
	f.PortWWN = int64(n.PortWWN)
517
	f.PortSupportedSpeed = int64(n.PortSupportedSpeed)
518
	f.AdapterType = int(n.adapter_type)
519
	f.VfcName = C.GoString(&n.vfc_name[0])
520
	f.ClientPartName = C.GoString(&n.client_part_name[0])
521

522
	return f
523
}
524

525
func perfstatlogicalvolume2logicalvolume(n *C.perfstat_logicalvolume_t) LogicalVolume {
526
	var l LogicalVolume
527

528
	l.Name = C.GoString(&n.name[0])
529
	l.VGName = C.GoString(&n.vgname[0])
530
	l.OpenClose = int64(n.open_close)
531
	l.State = int64(n.state)
532
	l.MirrorPolicy = int64(n.mirror_policy)
533
	l.MirrorWriteConsistency = int64(n.mirror_write_consistency)
534
	l.WriteVerify = int64(n.write_verify)
535
	l.PPsize = int64(n.ppsize)
536
	l.LogicalPartitions = int64(n.logical_partitions)
537
	l.Mirrors = int32(n.mirrors)
538
	l.IOCnt = int64(n.iocnt)
539
	l.KBReads = int64(n.kbreads)
540
	l.KBWrites = int64(n.kbwrites)
541
	l.Version = int64(n.version)
542

543
	return l
544
}
545

546
func perfstatvolumegroup2volumegroup(n *C.perfstat_volumegroup_t) VolumeGroup {
547
	var v VolumeGroup
548

549
	v.Name = C.GoString(&n.name[0])
550
	v.TotalDisks = int64(n.total_disks)
551
	v.ActiveDisks = int64(n.active_disks)
552
	v.TotalLogicalVolumes = int64(n.total_logical_volumes)
553
	v.OpenedLogicalVolumes = int64(n.opened_logical_volumes)
554
	v.IOCnt = int64(n.iocnt)
555
	v.KBReads = int64(n.kbreads)
556
	v.KBWrites = int64(n.kbwrites)
557
	v.Version = int64(n.version)
558
	v.VariedState = int(n.variedState)
559

560
	return v
561
}
562

563
func perfstatmemorypage2memorypage(n *C.perfstat_memory_page_t) MemoryPage {
564
	var m MemoryPage
565

566
	m.PSize = int64(n.psize)
567
	m.RealTotal = int64(n.real_total)
568
	m.RealFree = int64(n.real_free)
569
	m.RealPinned = int64(n.real_pinned)
570
	m.RealInUse = int64(n.real_inuse)
571
	m.PgExct = int64(n.pgexct)
572
	m.PgIns = int64(n.pgins)
573
	m.PgOuts = int64(n.pgouts)
574
	m.PgSpIns = int64(n.pgspins)
575
	m.PgSpOuts = int64(n.pgspouts)
576
	m.Scans = int64(n.scans)
577
	m.Cycles = int64(n.cycles)
578
	m.PgSteals = int64(n.pgsteals)
579
	m.NumPerm = int64(n.numperm)
580
	m.NumPgSp = int64(n.numpgsp)
581
	m.RealSystem = int64(n.real_system)
582
	m.RealUser = int64(n.real_user)
583
	m.RealProcess = int64(n.real_process)
584
	m.VirtActive = int64(n.virt_active)
585
	m.ComprsdTotal = int64(n.comprsd_total)
586
	m.ComprsdWsegPgs = int64(n.comprsd_wseg_pgs)
587
	m.CPgIns = int64(n.cpgins)
588
	m.CPgOuts = int64(n.cpgouts)
589
	m.CPoolInUse = int64(n.cpool_inuse)
590
	m.UCPoolSize = int64(n.ucpool_size)
591
	m.ComprsdWsegSize = int64(n.comprsd_wseg_size)
592
	m.Version = int64(n.version)
593
	m.RealAvail = int64(n.real_avail)
594

595
	return m
596
}
597

598
func perfstatnetbuffer2netbuffer(n *C.perfstat_netbuffer_t) NetBuffer {
599
	var b NetBuffer
600

601
	b.Name = C.GoString(&n.name[0])
602
	b.InUse = int64(n.inuse)
603
	b.Calls = int64(n.calls)
604
	b.Delayed = int64(n.delayed)
605
	b.Free = int64(n.free)
606
	b.Failed = int64(n.failed)
607
	b.HighWatermark = int64(n.highwatermark)
608
	b.Freed = int64(n.freed)
609
	b.Version = int64(n.version)
610

611
	return b
612
}
613

614
func perfstatnetinterface2netiface(n *C.perfstat_netinterface_t) NetIface {
615
	var i NetIface
616

617
	i.Name = C.GoString(&n.name[0])
618
	i.Description = C.GoString(&n.description[0])
619
	i.Type = uint8(n._type)
620
	i.MTU = int64(n.mtu)
621
	i.IPackets = int64(n.ipackets)
622
	i.IBytes = int64(n.ibytes)
623
	i.IErrors = int64(n.ierrors)
624
	i.OPackets = int64(n.opackets)
625
	i.OBytes = int64(n.obytes)
626
	i.OErrors = int64(n.oerrors)
627
	i.Collisions = int64(n.collisions)
628
	i.Bitrate = int64(n.bitrate)
629
	i.XmitDrops = int64(n.xmitdrops)
630
	i.Version = int64(n.version)
631
	i.IfIqDrops = int64(n.if_iqdrops)
632
	i.IfArpDrops = int64(n.if_arpdrops)
633

634
	return i
635
}
636

637
func perfstatnetadapter2netadapter(n *C.perfstat_netadapter_t) NetAdapter {
638
	var i NetAdapter
639

640
	i.Version = int64(n.version)
641
	i.Name = C.GoString(&n.name[0])
642
	i.TxPackets = int64(n.tx_packets)
643
	i.TxBytes = int64(n.tx_bytes)
644
	i.TxInterrupts = int64(n.tx_interrupts)
645
	i.TxErrors = int64(n.tx_errors)
646
	i.TxPacketsDropped = int64(n.tx_packets_dropped)
647
	i.TxQueueSize = int64(n.tx_queue_size)
648
	i.TxQueueLen = int64(n.tx_queue_len)
649
	i.TxQueueOverflow = int64(n.tx_queue_overflow)
650
	i.TxBroadcastPackets = int64(n.tx_broadcast_packets)
651
	i.TxMulticastPackets = int64(n.tx_multicast_packets)
652
	i.TxCarrierSense = int64(n.tx_carrier_sense)
653
	i.TxDMAUnderrun = int64(n.tx_DMA_underrun)
654
	i.TxLostCTSErrors = int64(n.tx_lost_CTS_errors)
655
	i.TxMaxCollisionErrors = int64(n.tx_max_collision_errors)
656
	i.TxLateCollisionErrors = int64(n.tx_late_collision_errors)
657
	i.TxDeferred = int64(n.tx_deferred)
658
	i.TxTimeoutErrors = int64(n.tx_timeout_errors)
659
	i.TxSingleCollisionCount = int64(n.tx_single_collision_count)
660
	i.TxMultipleCollisionCount = int64(n.tx_multiple_collision_count)
661
	i.RxPackets = int64(n.rx_packets)
662
	i.RxBytes = int64(n.rx_bytes)
663
	i.RxInterrupts = int64(n.rx_interrupts)
664
	i.RxErrors = int64(n.rx_errors)
665
	i.RxPacketsDropped = int64(n.rx_packets_dropped)
666
	i.RxBadPackets = int64(n.rx_bad_packets)
667
	i.RxMulticastPackets = int64(n.rx_multicast_packets)
668
	i.RxBroadcastPackets = int64(n.rx_broadcast_packets)
669
	i.RxCRCErrors = int64(n.rx_CRC_errors)
670
	i.RxDMAOverrun = int64(n.rx_DMA_overrun)
671
	i.RxAlignmentErrors = int64(n.rx_alignment_errors)
672
	i.RxNoResourceErrors = int64(n.rx_noresource_errors)
673
	i.RxCollisionErrors = int64(n.rx_collision_errors)
674
	i.RxPacketTooShortErrors = int64(n.rx_packet_tooshort_errors)
675
	i.RxPacketTooLongErrors = int64(n.rx_packet_toolong_errors)
676
	i.RxPacketDiscardedByAdapter = int64(n.rx_packets_discardedbyadapter)
677
	i.AdapterType = int32(n.adapter_type)
678

679
	return i
680
}
681

682
func perfstatpagingspace2pagingspace(n *C.perfstat_pagingspace_t) PagingSpace {
683
	var i PagingSpace
684

685
	i.Name = C.GoString(&n.name[0])
686
	i.Type = uint8(n._type)
687
	i.VGName = C.GoString(C.get_ps_vgname(n))
688
	i.Hostname = C.GoString(C.get_ps_hostname(n))
689
	i.Filename = C.GoString(C.get_ps_filename(n))
690
	i.LPSize = int64(n.lp_size)
691
	i.MBSize = int64(n.mb_size)
692
	i.MBUsed = int64(n.mb_used)
693
	i.IOPending = int64(n.io_pending)
694
	i.Active = uint8(n.active)
695
	i.Automatic = uint8(n.automatic)
696
	i.Version = int64(n.version)
697

698
	return i
699
}
700

701
func perfstatprocess2process(n *C.perfstat_process_t) Process {
702
	var i Process
703

704
	i.Version = int64(n.version)
705
	i.PID = int64(n.pid)
706
	i.ProcessName = C.GoString(&n.proc_name[0])
707
	i.Priority = int32(n.proc_priority)
708
	i.NumThreads = int64(n.num_threads)
709
	i.UID = int64(n.proc_uid)
710
	i.ClassID = int64(n.proc_classid)
711
	i.Size = int64(n.proc_size)
712
	i.RealMemData = int64(n.proc_real_mem_data)
713
	i.RealMemText = int64(n.proc_real_mem_text)
714
	i.VirtMemData = int64(n.proc_virt_mem_data)
715
	i.VirtMemText = int64(n.proc_virt_mem_text)
716
	i.SharedLibDataSize = int64(n.shared_lib_data_size)
717
	i.HeapSize = int64(n.heap_size)
718
	i.RealInUse = int64(n.real_inuse)
719
	i.VirtInUse = int64(n.virt_inuse)
720
	i.Pinned = int64(n.pinned)
721
	i.PgSpInUse = int64(n.pgsp_inuse)
722
	i.FilePages = int64(n.filepages)
723
	i.RealInUseMap = int64(n.real_inuse_map)
724
	i.VirtInUseMap = int64(n.virt_inuse_map)
725
	i.PinnedInUseMap = int64(n.pinned_inuse_map)
726
	i.UCpuTime = float64(n.ucpu_time)
727
	i.SCpuTime = float64(n.scpu_time)
728
	i.LastTimeBase = int64(n.last_timebase)
729
	i.InBytes = int64(n.inBytes)
730
	i.OutBytes = int64(n.outBytes)
731
	i.InOps = int64(n.inOps)
732
	i.OutOps = int64(n.outOps)
733

734
	return i
735
}
736

737
func perfstatthread2thread(n *C.perfstat_thread_t) Thread {
738
	var i Thread
739

740
	i.TID = int64(n.tid)
741
	i.PID = int64(n.pid)
742
	i.CpuID = int64(n.cpuid)
743
	i.UCpuTime = float64(n.ucpu_time)
744
	i.SCpuTime = float64(n.scpu_time)
745
	i.LastTimeBase = int64(n.last_timebase)
746
	i.Version = int64(n.version)
747

748
	return i
749
}
750

751
func fsinfo2filesystem(n *C.struct_fsinfo) FileSystem {
752
	var i FileSystem
753

754
	i.Device = C.GoString(n.devname)
755
	i.MountPoint = C.GoString(n.fsname)
756
	i.FSType = int(n.fstype)
757
	i.Flags = int(n.flags)
758
	i.TotalBlocks = int64(n.totalblks)
759
	i.FreeBlocks = int64(n.freeblks)
760
	i.TotalInodes = int64(n.totalinodes)
761
	i.FreeInodes = int64(n.freeinodes)
762

763
	return i
764
}
765

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.