podman
764 строки · 23.5 Кб
1// +build aix
2
3package perfstat
4
5/*
6#cgo LDFLAGS: -lperfstat
7
8#include <libperfstat.h>
9#include <sys/proc.h>
10
11#include "c_helpers.h"
12*/
13import "C"
14
15func perfstatcpu2cpu(n *C.perfstat_cpu_t) CPU {
16var c CPU
17c.Name = C.GoString(&n.name[0])
18c.User = int64(n.user)
19c.Sys = int64(n.sys)
20c.Idle = int64(n.idle)
21c.Wait = int64(n.wait)
22c.PSwitch = int64(n.pswitch)
23c.Syscall = int64(n.syscall)
24c.Sysread = int64(n.sysread)
25c.Syswrite = int64(n.syswrite)
26c.Sysfork = int64(n.sysfork)
27c.Sysexec = int64(n.sysexec)
28c.Readch = int64(n.readch)
29c.Writech = int64(n.writech)
30c.Bread = int64(n.bread)
31c.Bwrite = int64(n.bwrite)
32c.Lread = int64(n.lread)
33c.Lwrite = int64(n.lwrite)
34c.Phread = int64(n.phread)
35c.Phwrite = int64(n.phwrite)
36c.Iget = int64(n.iget)
37c.Namei = int64(n.namei)
38c.Dirblk = int64(n.dirblk)
39c.Msg = int64(n.msg)
40c.Sema = int64(n.sema)
41c.MinFaults = int64(n.minfaults)
42c.MajFaults = int64(n.majfaults)
43c.PUser = int64(n.puser)
44c.PSys = int64(n.psys)
45c.PIdle = int64(n.pidle)
46c.PWait = int64(n.pwait)
47c.RedispSD0 = int64(n.redisp_sd0)
48c.RedispSD1 = int64(n.redisp_sd1)
49c.RedispSD2 = int64(n.redisp_sd2)
50c.RedispSD3 = int64(n.redisp_sd3)
51c.RedispSD4 = int64(n.redisp_sd4)
52c.RedispSD5 = int64(n.redisp_sd5)
53c.MigrationPush = int64(n.migration_push)
54c.MigrationS3grq = int64(n.migration_S3grq)
55c.MigrationS3pul = int64(n.migration_S3pul)
56c.InvolCSwitch = int64(n.invol_cswitch)
57c.VolCSwitch = int64(n.vol_cswitch)
58c.RunQueue = int64(n.runque)
59c.Bound = int64(n.bound)
60c.DecrIntrs = int64(n.decrintrs)
61c.MpcRIntrs = int64(n.mpcrintrs)
62c.MpcSIntrs = int64(n.mpcsintrs)
63c.SoftIntrs = int64(n.softintrs)
64c.DevIntrs = int64(n.devintrs)
65c.PhantIntrs = int64(n.phantintrs)
66c.IdleDonatedPurr = int64(n.idle_donated_purr)
67c.IdleDonatedSpurr = int64(n.idle_donated_spurr)
68c.BusyDonatedPurr = int64(n.busy_donated_purr)
69c.BusyDonatedSpurr = int64(n.busy_donated_spurr)
70c.IdleStolenPurr = int64(n.idle_stolen_purr)
71c.IdleStolenSpurr = int64(n.idle_stolen_spurr)
72c.BusyStolenPurr = int64(n.busy_stolen_purr)
73c.BusyStolenSpurr = int64(n.busy_stolen_spurr)
74c.Hpi = int64(n.hpi)
75c.Hpit = int64(n.hpit)
76c.PUserSpurr = int64(n.puser_spurr)
77c.PSysSpurr = int64(n.psys_spurr)
78c.PIdleSpurr = int64(n.pidle_spurr)
79c.PWaitSpurr = int64(n.pwait_spurr)
80c.SpurrFlag = int32(n.spurrflag)
81c.LocalDispatch = int64(n.localdispatch)
82c.NearDispatch = int64(n.neardispatch)
83c.FarDispatch = int64(n.fardispatch)
84c.CSwitches = int64(n.cswitches)
85c.Version = int64(n.version)
86c.TbLast = int64(n.tb_last)
87c.State = int(n.state)
88c.VtbLast = int64(n.vtb_last)
89c.ICountLast = int64(n.icount_last)
90return c
91}
92
93func perfstatcputotal2cputotal(n *C.perfstat_cpu_total_t) CPUTotal {
94var c CPUTotal
95c.NCpus = int(n.ncpus)
96c.NCpusCfg = int(n.ncpus_cfg)
97c.Description = C.GoString(&n.description[0])
98c.ProcessorHz = int64(n.processorHZ)
99c.User = int64(n.user)
100c.Sys = int64(n.sys)
101c.Idle = int64(n.idle)
102c.Wait = int64(n.wait)
103c.PSwitch = int64(n.pswitch)
104c.Syscall = int64(n.syscall)
105c.Sysread = int64(n.sysread)
106c.Syswrite = int64(n.syswrite)
107c.Sysfork = int64(n.sysfork)
108c.Sysexec = int64(n.sysexec)
109c.Readch = int64(n.readch)
110c.Writech = int64(n.writech)
111c.DevIntrs = int64(n.devintrs)
112c.SoftIntrs = int64(n.softintrs)
113c.Lbolt = int64(n.lbolt)
114c.LoadAvg1 = (float32(n.loadavg[0]) / (1 << C.SBITS))
115c.LoadAvg5 = (float32(n.loadavg[1]) / (1 << C.SBITS))
116c.LoadAvg15 = (float32(n.loadavg[2]) / (1 << C.SBITS))
117c.RunQueue = int64(n.runque)
118c.SwpQueue = int64(n.swpque)
119c.Bread = int64(n.bread)
120c.Bwrite = int64(n.bwrite)
121c.Lread = int64(n.lread)
122c.Lwrite = int64(n.lwrite)
123c.Phread = int64(n.phread)
124c.Phwrite = int64(n.phwrite)
125c.RunOcc = int64(n.runocc)
126c.SwpOcc = int64(n.swpocc)
127c.Iget = int64(n.iget)
128c.Namei = int64(n.namei)
129c.Dirblk = int64(n.dirblk)
130c.Msg = int64(n.msg)
131c.Sema = int64(n.sema)
132c.RcvInt = int64(n.rcvint)
133c.XmtInt = int64(n.xmtint)
134c.MdmInt = int64(n.mdmint)
135c.TtyRawInch = int64(n.tty_rawinch)
136c.TtyCanInch = int64(n.tty_caninch)
137c.TtyRawOutch = int64(n.tty_rawoutch)
138c.Ksched = int64(n.ksched)
139c.Koverf = int64(n.koverf)
140c.Kexit = int64(n.kexit)
141c.Rbread = int64(n.rbread)
142c.Rcread = int64(n.rcread)
143c.Rbwrt = int64(n.rbwrt)
144c.Rcwrt = int64(n.rcwrt)
145c.Traps = int64(n.traps)
146c.NCpusHigh = int64(n.ncpus_high)
147c.PUser = int64(n.puser)
148c.PSys = int64(n.psys)
149c.PIdle = int64(n.pidle)
150c.PWait = int64(n.pwait)
151c.DecrIntrs = int64(n.decrintrs)
152c.MpcRIntrs = int64(n.mpcrintrs)
153c.MpcSIntrs = int64(n.mpcsintrs)
154c.PhantIntrs = int64(n.phantintrs)
155c.IdleDonatedPurr = int64(n.idle_donated_purr)
156c.IdleDonatedSpurr = int64(n.idle_donated_spurr)
157c.BusyDonatedPurr = int64(n.busy_donated_purr)
158c.BusyDonatedSpurr = int64(n.busy_donated_spurr)
159c.IdleStolenPurr = int64(n.idle_stolen_purr)
160c.IdleStolenSpurr = int64(n.idle_stolen_spurr)
161c.BusyStolenPurr = int64(n.busy_stolen_purr)
162c.BusyStolenSpurr = int64(n.busy_stolen_spurr)
163c.IOWait = int32(n.iowait)
164c.PhysIO = int32(n.physio)
165c.TWait = int64(n.twait)
166c.Hpi = int64(n.hpi)
167c.Hpit = int64(n.hpit)
168c.PUserSpurr = int64(n.puser_spurr)
169c.PSysSpurr = int64(n.psys_spurr)
170c.PIdleSpurr = int64(n.pidle_spurr)
171c.PWaitSpurr = int64(n.pwait_spurr)
172c.SpurrFlag = int(n.spurrflag)
173c.Version = int64(n.version)
174c.TbLast = int64(n.tb_last)
175c.PurrCoalescing = int64(n.purr_coalescing)
176c.SpurrCoalescing = int64(n.spurr_coalescing)
177return c
178}
179
180func perfstatcpuutil2cpuutil(n *C.perfstat_cpu_util_t) CPUUtil {
181var c CPUUtil
182
183c.Version = int64(n.version)
184c.CpuID = C.GoString(&n.cpu_id[0])
185c.Entitlement = float32(n.entitlement)
186c.UserPct = float32(n.user_pct)
187c.KernPct = float32(n.kern_pct)
188c.IdlePct = float32(n.idle_pct)
189c.WaitPct = float32(n.wait_pct)
190c.PhysicalBusy = float32(n.physical_busy)
191c.PhysicalConsumed = float32(n.physical_consumed)
192c.FreqPct = float32(n.freq_pct)
193c.EntitlementPct = float32(n.entitlement_pct)
194c.BusyPct = float32(n.busy_pct)
195c.IdleDonatedPct = float32(n.idle_donated_pct)
196c.BusyDonatedPct = float32(n.busy_donated_pct)
197c.IdleStolenPct = float32(n.idle_stolen_pct)
198c.BusyStolenPct = float32(n.busy_stolen_pct)
199c.LUserPct = float32(n.l_user_pct)
200c.LKernPct = float32(n.l_kern_pct)
201c.LIdlePct = float32(n.l_idle_pct)
202c.LWaitPct = float32(n.l_wait_pct)
203c.DeltaTime = int64(n.delta_time)
204
205return c
206}
207
208func perfstatdisktotal2disktotal(n C.perfstat_disk_total_t) DiskTotal {
209var d DiskTotal
210
211d.Number = int32(n.number)
212d.Size = int64(n.size)
213d.Free = int64(n.free)
214d.XRate = int64(n.xrate)
215d.Xfers = int64(n.xfers)
216d.Wblks = int64(n.wblks)
217d.Rblks = int64(n.rblks)
218d.Time = int64(n.time)
219d.Version = int64(n.version)
220d.Rserv = int64(n.rserv)
221d.MinRserv = int64(n.min_rserv)
222d.MaxRserv = int64(n.max_rserv)
223d.RTimeOut = int64(n.rtimeout)
224d.RFailed = int64(n.rfailed)
225d.Wserv = int64(n.wserv)
226d.MinWserv = int64(n.min_wserv)
227d.MaxWserv = int64(n.max_wserv)
228d.WTimeOut = int64(n.wtimeout)
229d.WFailed = int64(n.wfailed)
230d.WqDepth = int64(n.wq_depth)
231d.WqTime = int64(n.wq_time)
232d.WqMinTime = int64(n.wq_min_time)
233d.WqMaxTime = int64(n.wq_max_time)
234
235return d
236}
237
238func perfstatdiskadapter2diskadapter(n *C.perfstat_diskadapter_t) DiskAdapter {
239var d DiskAdapter
240
241d.Name = C.GoString(&n.name[0])
242d.Description = C.GoString(&n.description[0])
243d.Number = int32(n.number)
244d.Size = int64(n.size)
245d.Free = int64(n.free)
246d.XRate = int64(n.xrate)
247d.Xfers = int64(n.xfers)
248d.Rblks = int64(n.rblks)
249d.Wblks = int64(n.wblks)
250d.Time = int64(n.time)
251d.Version = int64(n.version)
252d.AdapterType = int64(n.adapter_type)
253d.DkBSize = int64(n.dk_bsize)
254d.DkRserv = int64(n.dk_rserv)
255d.DkWserv = int64(n.dk_wserv)
256d.MinRserv = int64(n.min_rserv)
257d.MaxRserv = int64(n.max_rserv)
258d.MinWserv = int64(n.min_wserv)
259d.MaxWserv = int64(n.max_wserv)
260d.WqDepth = int64(n.wq_depth)
261d.WqSampled = int64(n.wq_sampled)
262d.WqTime = int64(n.wq_time)
263d.WqMinTime = int64(n.wq_min_time)
264d.WqMaxTime = int64(n.wq_max_time)
265d.QFull = int64(n.q_full)
266d.QSampled = int64(n.q_sampled)
267
268return d
269}
270
271func perfstatpartitionconfig2partitionconfig(n C.perfstat_partition_config_t) PartitionConfig {
272var p PartitionConfig
273p.Version = int64(n.version)
274p.Name = C.GoString(&n.partitionname[0])
275p.Node = C.GoString(&n.nodename[0])
276p.Conf.SmtCapable = (n.conf[0] & (1 << 7)) > 0
277p.Conf.SmtEnabled = (n.conf[0] & (1 << 6)) > 0
278p.Conf.LparCapable = (n.conf[0] & (1 << 5)) > 0
279p.Conf.LparEnabled = (n.conf[0] & (1 << 4)) > 0
280p.Conf.SharedCapable = (n.conf[0] & (1 << 3)) > 0
281p.Conf.SharedEnabled = (n.conf[0] & (1 << 2)) > 0
282p.Conf.DLparCapable = (n.conf[0] & (1 << 1)) > 0
283p.Conf.Capped = (n.conf[0] & (1 << 0)) > 0
284p.Conf.Kernel64bit = (n.conf[1] & (1 << 7)) > 0
285p.Conf.PoolUtilAuthority = (n.conf[1] & (1 << 6)) > 0
286p.Conf.DonateCapable = (n.conf[1] & (1 << 5)) > 0
287p.Conf.DonateEnabled = (n.conf[1] & (1 << 4)) > 0
288p.Conf.AmsCapable = (n.conf[1] & (1 << 3)) > 0
289p.Conf.AmsEnabled = (n.conf[1] & (1 << 2)) > 0
290p.Conf.PowerSave = (n.conf[1] & (1 << 1)) > 0
291p.Conf.AmeEnabled = (n.conf[1] & (1 << 0)) > 0
292p.Conf.SharedExtended = (n.conf[2] & (1 << 7)) > 0
293p.Number = int32(n.partitionnum)
294p.GroupID = int32(n.groupid)
295p.ProcessorFamily = C.GoString(&n.processorFamily[0])
296p.ProcessorModel = C.GoString(&n.processorModel[0])
297p.MachineID = C.GoString(&n.machineID[0])
298p.ProcessorMhz = float64(C.get_partition_mhz(n))
299p.NumProcessors.Online = int64(n.numProcessors.online)
300p.NumProcessors.Max = int64(n.numProcessors.max)
301p.NumProcessors.Min = int64(n.numProcessors.min)
302p.NumProcessors.Desired = int64(n.numProcessors.desired)
303p.OSName = C.GoString(&n.OSName[0])
304p.OSVersion = C.GoString(&n.OSVersion[0])
305p.OSBuild = C.GoString(&n.OSBuild[0])
306p.LCpus = int32(n.lcpus)
307p.SmtThreads = int32(n.smtthreads)
308p.Drives = int32(n.drives)
309p.NetworkAdapters = int32(n.nw_adapters)
310p.CpuCap.Online = int64(n.cpucap.online)
311p.CpuCap.Max = int64(n.cpucap.max)
312p.CpuCap.Min = int64(n.cpucap.min)
313p.CpuCap.Desired = int64(n.cpucap.desired)
314p.Weightage = int32(n.cpucap_weightage)
315p.EntCapacity = int32(n.entitled_proc_capacity)
316p.VCpus.Online = int64(n.vcpus.online)
317p.VCpus.Max = int64(n.vcpus.max)
318p.VCpus.Min = int64(n.vcpus.min)
319p.VCpus.Desired = int64(n.vcpus.desired)
320p.PoolID = int32(n.processor_poolid)
321p.ActiveCpusInPool = int32(n.activecpusinpool)
322p.PoolWeightage = int32(n.cpupool_weightage)
323p.SharedPCpu = int32(n.sharedpcpu)
324p.MaxPoolCap = int32(n.maxpoolcap)
325p.EntPoolCap = int32(n.entpoolcap)
326p.Mem.Online = int64(n.mem.online)
327p.Mem.Max = int64(n.mem.max)
328p.Mem.Min = int64(n.mem.min)
329p.Mem.Desired = int64(n.mem.desired)
330p.MemWeightage = int32(n.mem_weightage)
331p.TotalIOMemoryEntitlement = int64(n.totiomement)
332p.MemPoolID = int32(n.mempoolid)
333p.HyperPgSize = int64(n.hyperpgsize)
334p.ExpMem.Online = int64(n.exp_mem.online)
335p.ExpMem.Max = int64(n.exp_mem.max)
336p.ExpMem.Min = int64(n.exp_mem.min)
337p.ExpMem.Desired = int64(n.exp_mem.desired)
338p.TargetMemExpFactor = int64(n.targetmemexpfactor)
339p.TargetMemExpSize = int64(n.targetmemexpsize)
340p.SubProcessorMode = int32(n.subprocessor_mode)
341return p
342}
343
344func perfstatmemorytotal2memorytotal(n C.perfstat_memory_total_t) MemoryTotal {
345var m MemoryTotal
346m.VirtualTotal = int64(n.virt_total)
347m.RealTotal = int64(n.real_total)
348m.RealFree = int64(n.real_free)
349m.RealPinned = int64(n.real_pinned)
350m.RealInUse = int64(n.real_inuse)
351m.BadPages = int64(n.pgbad)
352m.PageFaults = int64(n.pgexct)
353m.PageIn = int64(n.pgins)
354m.PageOut = int64(n.pgouts)
355m.PgSpIn = int64(n.pgspins)
356m.PgSpOut = int64(n.pgspouts)
357m.Scans = int64(n.scans)
358m.Cycles = int64(n.cycles)
359m.PgSteals = int64(n.pgsteals)
360m.NumPerm = int64(n.numperm)
361m.PgSpTotal = int64(n.pgsp_total)
362m.PgSpFree = int64(n.pgsp_free)
363m.PgSpRsvd = int64(n.pgsp_rsvd)
364m.RealSystem = int64(n.real_system)
365m.RealUser = int64(n.real_user)
366m.RealProcess = int64(n.real_process)
367m.VirtualActive = int64(n.virt_active)
368m.IOME = int64(n.iome)
369m.IOMU = int64(n.iomu)
370m.IOHWM = int64(n.iohwm)
371m.PMem = int64(n.pmem)
372m.CompressedTotal = int64(n.comprsd_total)
373m.CompressedWSegPg = int64(n.comprsd_wseg_pgs)
374m.CPgIn = int64(n.cpgins)
375m.CPgOut = int64(n.cpgouts)
376m.TrueSize = int64(n.true_size)
377m.ExpandedMemory = int64(n.expanded_memory)
378m.CompressedWSegSize = int64(n.comprsd_wseg_size)
379m.TargetCPoolSize = int64(n.target_cpool_size)
380m.MaxCPoolSize = int64(n.max_cpool_size)
381m.MinUCPoolSize = int64(n.min_ucpool_size)
382m.CPoolSize = int64(n.cpool_size)
383m.UCPoolSize = int64(n.ucpool_size)
384m.CPoolInUse = int64(n.cpool_inuse)
385m.UCPoolInUse = int64(n.ucpool_inuse)
386m.Version = int64(n.version)
387m.RealAvailable = int64(n.real_avail)
388m.BytesCoalesced = int64(n.bytes_coalesced)
389m.BytesCoalescedMemPool = int64(n.bytes_coalesced_mempool)
390
391return m
392}
393
394func perfstatnetinterfacetotal2netifacetotal(n C.perfstat_netinterface_total_t) NetIfaceTotal {
395var i NetIfaceTotal
396
397i.Number = int32(n.number)
398i.IPackets = int64(n.ipackets)
399i.IBytes = int64(n.ibytes)
400i.IErrors = int64(n.ierrors)
401i.OPackets = int64(n.opackets)
402i.OBytes = int64(n.obytes)
403i.OErrors = int64(n.oerrors)
404i.Collisions = int64(n.collisions)
405i.XmitDrops = int64(n.xmitdrops)
406i.Version = int64(n.version)
407
408return i
409}
410
411func perfstatdisk2disk(n *C.perfstat_disk_t) Disk {
412var d Disk
413
414d.Name = C.GoString(&n.name[0])
415d.Description = C.GoString(&n.description[0])
416d.VGName = C.GoString(&n.vgname[0])
417d.Size = int64(n.size)
418d.Free = int64(n.free)
419d.BSize = int64(n.bsize)
420d.XRate = int64(n.xrate)
421d.Xfers = int64(n.xfers)
422d.Wblks = int64(n.wblks)
423d.Rblks = int64(n.rblks)
424d.QDepth = int64(n.qdepth)
425d.Time = int64(n.time)
426d.Adapter = C.GoString(&n.adapter[0])
427d.PathsCount = int32(n.paths_count)
428d.QFull = int64(n.q_full)
429d.Rserv = int64(n.rserv)
430d.RTimeOut = int64(n.rtimeout)
431d.Rfailed = int64(n.rfailed)
432d.MinRserv = int64(n.min_rserv)
433d.MaxRserv = int64(n.max_rserv)
434d.Wserv = int64(n.wserv)
435d.WTimeOut = int64(n.wtimeout)
436d.Wfailed = int64(n.wfailed)
437d.MinWserv = int64(n.min_wserv)
438d.MaxWserv = int64(n.max_wserv)
439d.WqDepth = int64(n.wq_depth)
440d.WqSampled = int64(n.wq_sampled)
441d.WqTime = int64(n.wq_time)
442d.WqMinTime = int64(n.wq_min_time)
443d.WqMaxTime = int64(n.wq_max_time)
444d.QSampled = int64(n.q_sampled)
445d.Version = int64(n.version)
446d.PseudoDisk = (n.dk_type[0] & (1 << 7)) > 0
447d.VTDisk = (n.dk_type[0] & (1 << 6)) > 0
448
449return d
450}
451
452func perfstatdiskpath2diskpath(n *C.perfstat_diskpath_t) DiskPath {
453var d DiskPath
454
455d.Name = C.GoString(&n.name[0])
456d.XRate = int64(n.xrate)
457d.Xfers = int64(n.xfers)
458d.Rblks = int64(n.rblks)
459d.Wblks = int64(n.wblks)
460d.Time = int64(n.time)
461d.Adapter = C.GoString(&n.adapter[0])
462d.QFull = int64(n.q_full)
463d.Rserv = int64(n.rserv)
464d.RTimeOut = int64(n.rtimeout)
465d.Rfailed = int64(n.rfailed)
466d.MinRserv = int64(n.min_rserv)
467d.MaxRserv = int64(n.max_rserv)
468d.Wserv = int64(n.wserv)
469d.WTimeOut = int64(n.wtimeout)
470d.Wfailed = int64(n.wfailed)
471d.MinWserv = int64(n.min_wserv)
472d.MaxWserv = int64(n.max_wserv)
473d.WqDepth = int64(n.wq_depth)
474d.WqSampled = int64(n.wq_sampled)
475d.WqTime = int64(n.wq_time)
476d.WqMinTime = int64(n.wq_min_time)
477d.WqMaxTime = int64(n.wq_max_time)
478d.QSampled = int64(n.q_sampled)
479d.Version = int64(n.version)
480
481return d
482}
483
484func perfstatfcstat2fcadapter(n *C.perfstat_fcstat_t) FCAdapter {
485var f FCAdapter
486
487f.Version = int64(n.version)
488f.Name = C.GoString(&n.name[0])
489f.State = int32(n.state)
490f.InputRequests = int64(n.InputRequests)
491f.OutputRequests = int64(n.OutputRequests)
492f.InputBytes = int64(n.InputBytes)
493f.OutputBytes = int64(n.OutputBytes)
494f.EffMaxTransfer = int64(n.EffMaxTransfer)
495f.NoDMAResourceCnt = int64(n.NoDMAResourceCnt)
496f.NoCmdResourceCnt = int64(n.NoCmdResourceCnt)
497f.AttentionType = int32(n.AttentionType)
498f.SecondsSinceLastReset = int64(n.SecondsSinceLastReset)
499f.TxFrames = int64(n.TxFrames)
500f.TxWords = int64(n.TxWords)
501f.RxFrames = int64(n.RxFrames)
502f.RxWords = int64(n.RxWords)
503f.LIPCount = int64(n.LIPCount)
504f.NOSCount = int64(n.NOSCount)
505f.ErrorFrames = int64(n.ErrorFrames)
506f.DumpedFrames = int64(n.DumpedFrames)
507f.LinkFailureCount = int64(n.LinkFailureCount)
508f.LossofSyncCount = int64(n.LossofSyncCount)
509f.LossofSignal = int64(n.LossofSignal)
510f.PrimitiveSeqProtocolErrCount = int64(n.PrimitiveSeqProtocolErrCount)
511f.InvalidTxWordCount = int64(n.InvalidTxWordCount)
512f.InvalidCRCCount = int64(n.InvalidCRCCount)
513f.PortFcId = int64(n.PortFcId)
514f.PortSpeed = int64(n.PortSpeed)
515f.PortType = C.GoString(&n.PortType[0])
516f.PortWWN = int64(n.PortWWN)
517f.PortSupportedSpeed = int64(n.PortSupportedSpeed)
518f.AdapterType = int(n.adapter_type)
519f.VfcName = C.GoString(&n.vfc_name[0])
520f.ClientPartName = C.GoString(&n.client_part_name[0])
521
522return f
523}
524
525func perfstatlogicalvolume2logicalvolume(n *C.perfstat_logicalvolume_t) LogicalVolume {
526var l LogicalVolume
527
528l.Name = C.GoString(&n.name[0])
529l.VGName = C.GoString(&n.vgname[0])
530l.OpenClose = int64(n.open_close)
531l.State = int64(n.state)
532l.MirrorPolicy = int64(n.mirror_policy)
533l.MirrorWriteConsistency = int64(n.mirror_write_consistency)
534l.WriteVerify = int64(n.write_verify)
535l.PPsize = int64(n.ppsize)
536l.LogicalPartitions = int64(n.logical_partitions)
537l.Mirrors = int32(n.mirrors)
538l.IOCnt = int64(n.iocnt)
539l.KBReads = int64(n.kbreads)
540l.KBWrites = int64(n.kbwrites)
541l.Version = int64(n.version)
542
543return l
544}
545
546func perfstatvolumegroup2volumegroup(n *C.perfstat_volumegroup_t) VolumeGroup {
547var v VolumeGroup
548
549v.Name = C.GoString(&n.name[0])
550v.TotalDisks = int64(n.total_disks)
551v.ActiveDisks = int64(n.active_disks)
552v.TotalLogicalVolumes = int64(n.total_logical_volumes)
553v.OpenedLogicalVolumes = int64(n.opened_logical_volumes)
554v.IOCnt = int64(n.iocnt)
555v.KBReads = int64(n.kbreads)
556v.KBWrites = int64(n.kbwrites)
557v.Version = int64(n.version)
558v.VariedState = int(n.variedState)
559
560return v
561}
562
563func perfstatmemorypage2memorypage(n *C.perfstat_memory_page_t) MemoryPage {
564var m MemoryPage
565
566m.PSize = int64(n.psize)
567m.RealTotal = int64(n.real_total)
568m.RealFree = int64(n.real_free)
569m.RealPinned = int64(n.real_pinned)
570m.RealInUse = int64(n.real_inuse)
571m.PgExct = int64(n.pgexct)
572m.PgIns = int64(n.pgins)
573m.PgOuts = int64(n.pgouts)
574m.PgSpIns = int64(n.pgspins)
575m.PgSpOuts = int64(n.pgspouts)
576m.Scans = int64(n.scans)
577m.Cycles = int64(n.cycles)
578m.PgSteals = int64(n.pgsteals)
579m.NumPerm = int64(n.numperm)
580m.NumPgSp = int64(n.numpgsp)
581m.RealSystem = int64(n.real_system)
582m.RealUser = int64(n.real_user)
583m.RealProcess = int64(n.real_process)
584m.VirtActive = int64(n.virt_active)
585m.ComprsdTotal = int64(n.comprsd_total)
586m.ComprsdWsegPgs = int64(n.comprsd_wseg_pgs)
587m.CPgIns = int64(n.cpgins)
588m.CPgOuts = int64(n.cpgouts)
589m.CPoolInUse = int64(n.cpool_inuse)
590m.UCPoolSize = int64(n.ucpool_size)
591m.ComprsdWsegSize = int64(n.comprsd_wseg_size)
592m.Version = int64(n.version)
593m.RealAvail = int64(n.real_avail)
594
595return m
596}
597
598func perfstatnetbuffer2netbuffer(n *C.perfstat_netbuffer_t) NetBuffer {
599var b NetBuffer
600
601b.Name = C.GoString(&n.name[0])
602b.InUse = int64(n.inuse)
603b.Calls = int64(n.calls)
604b.Delayed = int64(n.delayed)
605b.Free = int64(n.free)
606b.Failed = int64(n.failed)
607b.HighWatermark = int64(n.highwatermark)
608b.Freed = int64(n.freed)
609b.Version = int64(n.version)
610
611return b
612}
613
614func perfstatnetinterface2netiface(n *C.perfstat_netinterface_t) NetIface {
615var i NetIface
616
617i.Name = C.GoString(&n.name[0])
618i.Description = C.GoString(&n.description[0])
619i.Type = uint8(n._type)
620i.MTU = int64(n.mtu)
621i.IPackets = int64(n.ipackets)
622i.IBytes = int64(n.ibytes)
623i.IErrors = int64(n.ierrors)
624i.OPackets = int64(n.opackets)
625i.OBytes = int64(n.obytes)
626i.OErrors = int64(n.oerrors)
627i.Collisions = int64(n.collisions)
628i.Bitrate = int64(n.bitrate)
629i.XmitDrops = int64(n.xmitdrops)
630i.Version = int64(n.version)
631i.IfIqDrops = int64(n.if_iqdrops)
632i.IfArpDrops = int64(n.if_arpdrops)
633
634return i
635}
636
637func perfstatnetadapter2netadapter(n *C.perfstat_netadapter_t) NetAdapter {
638var i NetAdapter
639
640i.Version = int64(n.version)
641i.Name = C.GoString(&n.name[0])
642i.TxPackets = int64(n.tx_packets)
643i.TxBytes = int64(n.tx_bytes)
644i.TxInterrupts = int64(n.tx_interrupts)
645i.TxErrors = int64(n.tx_errors)
646i.TxPacketsDropped = int64(n.tx_packets_dropped)
647i.TxQueueSize = int64(n.tx_queue_size)
648i.TxQueueLen = int64(n.tx_queue_len)
649i.TxQueueOverflow = int64(n.tx_queue_overflow)
650i.TxBroadcastPackets = int64(n.tx_broadcast_packets)
651i.TxMulticastPackets = int64(n.tx_multicast_packets)
652i.TxCarrierSense = int64(n.tx_carrier_sense)
653i.TxDMAUnderrun = int64(n.tx_DMA_underrun)
654i.TxLostCTSErrors = int64(n.tx_lost_CTS_errors)
655i.TxMaxCollisionErrors = int64(n.tx_max_collision_errors)
656i.TxLateCollisionErrors = int64(n.tx_late_collision_errors)
657i.TxDeferred = int64(n.tx_deferred)
658i.TxTimeoutErrors = int64(n.tx_timeout_errors)
659i.TxSingleCollisionCount = int64(n.tx_single_collision_count)
660i.TxMultipleCollisionCount = int64(n.tx_multiple_collision_count)
661i.RxPackets = int64(n.rx_packets)
662i.RxBytes = int64(n.rx_bytes)
663i.RxInterrupts = int64(n.rx_interrupts)
664i.RxErrors = int64(n.rx_errors)
665i.RxPacketsDropped = int64(n.rx_packets_dropped)
666i.RxBadPackets = int64(n.rx_bad_packets)
667i.RxMulticastPackets = int64(n.rx_multicast_packets)
668i.RxBroadcastPackets = int64(n.rx_broadcast_packets)
669i.RxCRCErrors = int64(n.rx_CRC_errors)
670i.RxDMAOverrun = int64(n.rx_DMA_overrun)
671i.RxAlignmentErrors = int64(n.rx_alignment_errors)
672i.RxNoResourceErrors = int64(n.rx_noresource_errors)
673i.RxCollisionErrors = int64(n.rx_collision_errors)
674i.RxPacketTooShortErrors = int64(n.rx_packet_tooshort_errors)
675i.RxPacketTooLongErrors = int64(n.rx_packet_toolong_errors)
676i.RxPacketDiscardedByAdapter = int64(n.rx_packets_discardedbyadapter)
677i.AdapterType = int32(n.adapter_type)
678
679return i
680}
681
682func perfstatpagingspace2pagingspace(n *C.perfstat_pagingspace_t) PagingSpace {
683var i PagingSpace
684
685i.Name = C.GoString(&n.name[0])
686i.Type = uint8(n._type)
687i.VGName = C.GoString(C.get_ps_vgname(n))
688i.Hostname = C.GoString(C.get_ps_hostname(n))
689i.Filename = C.GoString(C.get_ps_filename(n))
690i.LPSize = int64(n.lp_size)
691i.MBSize = int64(n.mb_size)
692i.MBUsed = int64(n.mb_used)
693i.IOPending = int64(n.io_pending)
694i.Active = uint8(n.active)
695i.Automatic = uint8(n.automatic)
696i.Version = int64(n.version)
697
698return i
699}
700
701func perfstatprocess2process(n *C.perfstat_process_t) Process {
702var i Process
703
704i.Version = int64(n.version)
705i.PID = int64(n.pid)
706i.ProcessName = C.GoString(&n.proc_name[0])
707i.Priority = int32(n.proc_priority)
708i.NumThreads = int64(n.num_threads)
709i.UID = int64(n.proc_uid)
710i.ClassID = int64(n.proc_classid)
711i.Size = int64(n.proc_size)
712i.RealMemData = int64(n.proc_real_mem_data)
713i.RealMemText = int64(n.proc_real_mem_text)
714i.VirtMemData = int64(n.proc_virt_mem_data)
715i.VirtMemText = int64(n.proc_virt_mem_text)
716i.SharedLibDataSize = int64(n.shared_lib_data_size)
717i.HeapSize = int64(n.heap_size)
718i.RealInUse = int64(n.real_inuse)
719i.VirtInUse = int64(n.virt_inuse)
720i.Pinned = int64(n.pinned)
721i.PgSpInUse = int64(n.pgsp_inuse)
722i.FilePages = int64(n.filepages)
723i.RealInUseMap = int64(n.real_inuse_map)
724i.VirtInUseMap = int64(n.virt_inuse_map)
725i.PinnedInUseMap = int64(n.pinned_inuse_map)
726i.UCpuTime = float64(n.ucpu_time)
727i.SCpuTime = float64(n.scpu_time)
728i.LastTimeBase = int64(n.last_timebase)
729i.InBytes = int64(n.inBytes)
730i.OutBytes = int64(n.outBytes)
731i.InOps = int64(n.inOps)
732i.OutOps = int64(n.outOps)
733
734return i
735}
736
737func perfstatthread2thread(n *C.perfstat_thread_t) Thread {
738var i Thread
739
740i.TID = int64(n.tid)
741i.PID = int64(n.pid)
742i.CpuID = int64(n.cpuid)
743i.UCpuTime = float64(n.ucpu_time)
744i.SCpuTime = float64(n.scpu_time)
745i.LastTimeBase = int64(n.last_timebase)
746i.Version = int64(n.version)
747
748return i
749}
750
751func fsinfo2filesystem(n *C.struct_fsinfo) FileSystem {
752var i FileSystem
753
754i.Device = C.GoString(n.devname)
755i.MountPoint = C.GoString(n.fsname)
756i.FSType = int(n.fstype)
757i.Flags = int(n.flags)
758i.TotalBlocks = int64(n.totalblks)
759i.FreeBlocks = int64(n.freeblks)
760i.TotalInodes = int64(n.totalinodes)
761i.FreeInodes = int64(n.freeinodes)
762
763return i
764}
765