/* cpuprovider.c generated by valac 0.22.1, the Vala compiler
 * generated from cpuprovider.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include "glibtop.h"
#include <float.h>
#include <math.h>
#include "glibtop/cpu.h"


#define TYPE_PROVIDER (provider_get_type ())
#define PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PROVIDER, Provider))
#define PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PROVIDER, ProviderClass))
#define IS_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PROVIDER))
#define IS_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PROVIDER))
#define PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PROVIDER, ProviderClass))

typedef struct _Provider Provider;
typedef struct _ProviderClass ProviderClass;
typedef struct _ProviderPrivate ProviderPrivate;

#define TYPE_CPU_PROVIDER (cpu_provider_get_type ())
#define CPU_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CPU_PROVIDER, CpuProvider))
#define CPU_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CPU_PROVIDER, CpuProviderClass))
#define IS_CPU_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CPU_PROVIDER))
#define IS_CPU_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CPU_PROVIDER))
#define CPU_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CPU_PROVIDER, CpuProviderClass))

typedef struct _CpuProvider CpuProvider;
typedef struct _CpuProviderClass CpuProviderClass;
typedef struct _CpuProviderPrivate CpuProviderPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _Provider {
	GObject parent_instance;
	ProviderPrivate * priv;
};

struct _ProviderClass {
	GObjectClass parent_class;
	void (*update) (Provider* self);
};

struct _CpuProvider {
	Provider parent_instance;
	CpuProviderPrivate * priv;
};

struct _CpuProviderClass {
	ProviderClass parent_class;
};

struct _CpuProviderPrivate {
	guint64* lastdata;
	gint lastdata_length1;
	gint _lastdata_size_;
	guint64* newdata;
	gint newdata_length1;
	gint _newdata_size_;
};


static gpointer cpu_provider_parent_class = NULL;

GType provider_get_type (void) G_GNUC_CONST;
GType cpu_provider_get_type (void) G_GNUC_CONST;
#define CPU_PROVIDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_CPU_PROVIDER, CpuProviderPrivate))
enum  {
	CPU_PROVIDER_DUMMY_PROPERTY
};
static gchar** cpu_provider_fields (int* result_length1);
CpuProvider* cpu_provider_new (void);
CpuProvider* cpu_provider_construct (GType object_type);
Provider* provider_construct (GType object_type, const gchar* id, gchar** keys, int keys_length1, gchar displaytype);
static void cpu_provider_updatecpu (CpuProvider* self, guint index, guint64 user, guint64 sys, guint64 nice, guint64 idle, guint64 io);
gdouble* provider_get_values (Provider* self, int* result_length1);
static void cpu_provider_real_update (Provider* base);
static guint64* _vala_array_dup3 (guint64* self, int length);
static void cpu_provider_finalize (GObject* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


static const gchar* string_to_string (const gchar* self) {
	const gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}


static gchar** cpu_provider_fields (int* result_length1) {
	gchar** result = NULL;
	gchar** templates = NULL;
	gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	gchar* _tmp5_ = NULL;
	gchar** _tmp6_ = NULL;
	gint templates_length1 = 0;
	gint _templates_size_ = 0;
	gchar** _result_ = NULL;
	glibtop* _tmp7_ = NULL;
	gint _tmp8_ = 0;
	gchar** _tmp9_ = NULL;
	gint _result__length1 = 0;
	gint __result__size_ = 0;
	gchar** _tmp40_ = NULL;
	gint _tmp40__length1 = 0;
	glibtop_init ();
	_tmp0_ = g_strdup ("user");
	_tmp1_ = g_strdup ("sys");
	_tmp2_ = g_strdup ("nice");
	_tmp3_ = g_strdup ("idle");
	_tmp4_ = g_strdup ("io");
	_tmp5_ = g_strdup ("inuse");
	_tmp6_ = g_new0 (gchar*, 6 + 1);
	_tmp6_[0] = _tmp0_;
	_tmp6_[1] = _tmp1_;
	_tmp6_[2] = _tmp2_;
	_tmp6_[3] = _tmp3_;
	_tmp6_[4] = _tmp4_;
	_tmp6_[5] = _tmp5_;
	templates = _tmp6_;
	templates_length1 = 6;
	_templates_size_ = templates_length1;
	_tmp7_ = glibtop_global_server;
	_tmp8_ = (*_tmp7_).ncpu;
	_tmp9_ = g_new0 (gchar*, ((_tmp8_ + 2) * 6) + 1);
	_result_ = _tmp9_;
	_result__length1 = (_tmp8_ + 2) * 6;
	__result__size_ = _result__length1;
	{
		guint j = 0U;
		j = (guint) 0;
		{
			gboolean _tmp10_ = FALSE;
			_tmp10_ = TRUE;
			while (TRUE) {
				gboolean _tmp11_ = FALSE;
				guint _tmp13_ = 0U;
				gchar* template = NULL;
				gchar** _tmp14_ = NULL;
				gint _tmp14__length1 = 0;
				guint _tmp15_ = 0U;
				const gchar* _tmp16_ = NULL;
				gchar* _tmp17_ = NULL;
				gchar** _tmp18_ = NULL;
				gint _tmp18__length1 = 0;
				guint _tmp19_ = 0U;
				const gchar* _tmp20_ = NULL;
				gchar* _tmp21_ = NULL;
				gchar* _tmp22_ = NULL;
				_tmp11_ = _tmp10_;
				if (!_tmp11_) {
					guint _tmp12_ = 0U;
					_tmp12_ = j;
					j = _tmp12_ + 1;
				}
				_tmp10_ = FALSE;
				_tmp13_ = j;
				if (!(_tmp13_ < ((guint) 6))) {
					break;
				}
				_tmp14_ = templates;
				_tmp14__length1 = templates_length1;
				_tmp15_ = j;
				_tmp16_ = _tmp14_[_tmp15_];
				_tmp17_ = g_strdup (_tmp16_);
				template = _tmp17_;
				_tmp18_ = _result_;
				_tmp18__length1 = _result__length1;
				_tmp19_ = j;
				_tmp20_ = template;
				_tmp21_ = g_strdup (_tmp20_);
				_g_free0 (_tmp18_[_tmp19_]);
				_tmp18_[_tmp19_] = _tmp21_;
				_tmp22_ = _tmp18_[_tmp19_];
				{
					guint i = 0U;
					guint isize = 0U;
					glibtop* _tmp23_ = NULL;
					gint _tmp24_ = 0;
					i = (guint) 0;
					_tmp23_ = glibtop_global_server;
					_tmp24_ = (*_tmp23_).ncpu;
					isize = (guint) (_tmp24_ + 1);
					{
						gboolean _tmp25_ = FALSE;
						_tmp25_ = TRUE;
						while (TRUE) {
							gboolean _tmp26_ = FALSE;
							guint _tmp28_ = 0U;
							guint _tmp29_ = 0U;
							gchar** _tmp30_ = NULL;
							gint _tmp30__length1 = 0;
							guint _tmp31_ = 0U;
							guint _tmp32_ = 0U;
							guint _tmp33_ = 0U;
							gchar* _tmp34_ = NULL;
							gchar* _tmp35_ = NULL;
							const gchar* _tmp36_ = NULL;
							const gchar* _tmp37_ = NULL;
							gchar* _tmp38_ = NULL;
							gchar* _tmp39_ = NULL;
							_tmp26_ = _tmp25_;
							if (!_tmp26_) {
								guint _tmp27_ = 0U;
								_tmp27_ = i;
								i = _tmp27_ + 1;
							}
							_tmp25_ = FALSE;
							_tmp28_ = i;
							_tmp29_ = isize;
							if (!(_tmp28_ < _tmp29_)) {
								break;
							}
							_tmp30_ = _result_;
							_tmp30__length1 = _result__length1;
							_tmp31_ = i;
							_tmp32_ = j;
							_tmp33_ = i;
							_tmp34_ = g_strdup_printf ("%u", _tmp33_);
							_tmp35_ = _tmp34_;
							_tmp36_ = template;
							_tmp37_ = string_to_string (_tmp36_);
							_tmp38_ = g_strconcat ("cpu", _tmp35_, ".", _tmp37_, NULL);
							_g_free0 (_tmp30_[((_tmp31_ + 1) * 6) + _tmp32_]);
							_tmp30_[((_tmp31_ + 1) * 6) + _tmp32_] = _tmp38_;
							_tmp39_ = _tmp30_[((_tmp31_ + 1) * 6) + _tmp32_];
							_g_free0 (_tmp35_);
						}
					}
				}
				_g_free0 (template);
			}
		}
	}
	_tmp40_ = _result_;
	_tmp40__length1 = _result__length1;
	if (result_length1) {
		*result_length1 = _tmp40__length1;
	}
	result = _tmp40_;
	templates = (_vala_array_free (templates, templates_length1, (GDestroyNotify) g_free), NULL);
	return result;
}


CpuProvider* cpu_provider_construct (GType object_type) {
	CpuProvider * self = NULL;
	gint _tmp0_ = 0;
	gchar** _tmp1_ = NULL;
	gchar** _tmp2_ = NULL;
	gint _tmp2__length1 = 0;
	_tmp1_ = cpu_provider_fields (&_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp0_;
	self = (CpuProvider*) provider_construct (object_type, "cpu", _tmp2_, _tmp0_, 'p');
	_tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL);
	return self;
}


CpuProvider* cpu_provider_new (void) {
	return cpu_provider_construct (TYPE_CPU_PROVIDER);
}


static void cpu_provider_updatecpu (CpuProvider* self, guint index, guint64 user, guint64 sys, guint64 nice, guint64 idle, guint64 io) {
	guint64* _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	guint _tmp1_ = 0U;
	guint64 _tmp2_ = 0ULL;
	guint64 _tmp3_ = 0ULL;
	guint64* _tmp4_ = NULL;
	gint _tmp4__length1 = 0;
	guint _tmp5_ = 0U;
	guint64 _tmp6_ = 0ULL;
	guint64 _tmp7_ = 0ULL;
	guint64* _tmp8_ = NULL;
	gint _tmp8__length1 = 0;
	guint _tmp9_ = 0U;
	guint64 _tmp10_ = 0ULL;
	guint64 _tmp11_ = 0ULL;
	guint64* _tmp12_ = NULL;
	gint _tmp12__length1 = 0;
	guint _tmp13_ = 0U;
	guint64 _tmp14_ = 0ULL;
	guint64 _tmp15_ = 0ULL;
	guint64* _tmp16_ = NULL;
	gint _tmp16__length1 = 0;
	guint _tmp17_ = 0U;
	guint64 _tmp18_ = 0ULL;
	guint64 _tmp19_ = 0ULL;
	guint64* _tmp20_ = NULL;
	gint _tmp20__length1 = 0;
	guint _tmp21_ = 0U;
	guint64 _tmp22_ = 0ULL;
	guint64 _tmp23_ = 0ULL;
	guint64 _tmp24_ = 0ULL;
	guint64 _tmp25_ = 0ULL;
	gdouble total = 0.0;
	guint64* _tmp26_ = NULL;
	gint _tmp26__length1 = 0;
	g_return_if_fail (IS_CPU_PROVIDER (self));
	_tmp0_ = self->priv->newdata;
	_tmp0__length1 = self->priv->newdata_length1;
	_tmp1_ = index;
	_tmp2_ = user;
	_tmp0_[_tmp1_ + 0] = _tmp2_;
	_tmp3_ = _tmp0_[_tmp1_ + 0];
	_tmp4_ = self->priv->newdata;
	_tmp4__length1 = self->priv->newdata_length1;
	_tmp5_ = index;
	_tmp6_ = sys;
	_tmp4_[_tmp5_ + 1] = _tmp6_;
	_tmp7_ = _tmp4_[_tmp5_ + 1];
	_tmp8_ = self->priv->newdata;
	_tmp8__length1 = self->priv->newdata_length1;
	_tmp9_ = index;
	_tmp10_ = nice;
	_tmp8_[_tmp9_ + 2] = _tmp10_;
	_tmp11_ = _tmp8_[_tmp9_ + 2];
	_tmp12_ = self->priv->newdata;
	_tmp12__length1 = self->priv->newdata_length1;
	_tmp13_ = index;
	_tmp14_ = idle;
	_tmp12_[_tmp13_ + 3] = _tmp14_;
	_tmp15_ = _tmp12_[_tmp13_ + 3];
	_tmp16_ = self->priv->newdata;
	_tmp16__length1 = self->priv->newdata_length1;
	_tmp17_ = index;
	_tmp18_ = io;
	_tmp16_[_tmp17_ + 4] = _tmp18_;
	_tmp19_ = _tmp16_[_tmp17_ + 4];
	_tmp20_ = self->priv->newdata;
	_tmp20__length1 = self->priv->newdata_length1;
	_tmp21_ = index;
	_tmp22_ = user;
	_tmp23_ = nice;
	_tmp24_ = sys;
	_tmp20_[_tmp21_ + 5] = (_tmp22_ + _tmp23_) + _tmp24_;
	_tmp25_ = _tmp20_[_tmp21_ + 5];
	total = (gdouble) 0;
	_tmp26_ = self->priv->lastdata;
	_tmp26__length1 = self->priv->lastdata_length1;
	if (_tmp26__length1 != 0) {
		{
			guint i = 0U;
			guint _tmp27_ = 0U;
			_tmp27_ = index;
			i = _tmp27_;
			{
				gboolean _tmp28_ = FALSE;
				_tmp28_ = TRUE;
				while (TRUE) {
					gboolean _tmp29_ = FALSE;
					guint _tmp31_ = 0U;
					guint _tmp32_ = 0U;
					gdouble _tmp33_ = 0.0;
					guint64* _tmp34_ = NULL;
					gint _tmp34__length1 = 0;
					guint _tmp35_ = 0U;
					guint64 _tmp36_ = 0ULL;
					guint64* _tmp37_ = NULL;
					gint _tmp37__length1 = 0;
					guint _tmp38_ = 0U;
					guint64 _tmp39_ = 0ULL;
					_tmp29_ = _tmp28_;
					if (!_tmp29_) {
						guint _tmp30_ = 0U;
						_tmp30_ = i;
						i = _tmp30_ + 1;
					}
					_tmp28_ = FALSE;
					_tmp31_ = i;
					_tmp32_ = index;
					if (!(_tmp31_ < (_tmp32_ + 5))) {
						break;
					}
					_tmp33_ = total;
					_tmp34_ = self->priv->newdata;
					_tmp34__length1 = self->priv->newdata_length1;
					_tmp35_ = i;
					_tmp36_ = _tmp34_[_tmp35_];
					_tmp37_ = self->priv->lastdata;
					_tmp37__length1 = self->priv->lastdata_length1;
					_tmp38_ = i;
					_tmp39_ = _tmp37_[_tmp38_];
					total = _tmp33_ + (_tmp36_ - _tmp39_);
				}
			}
		}
		{
			guint i = 0U;
			guint _tmp40_ = 0U;
			_tmp40_ = index;
			i = _tmp40_;
			{
				gboolean _tmp41_ = FALSE;
				_tmp41_ = TRUE;
				while (TRUE) {
					gboolean _tmp42_ = FALSE;
					guint _tmp44_ = 0U;
					guint _tmp45_ = 0U;
					gdouble* _tmp46_ = NULL;
					gint _tmp46__length1 = 0;
					gdouble* _tmp47_ = NULL;
					gint _tmp47__length1 = 0;
					guint _tmp48_ = 0U;
					guint64* _tmp49_ = NULL;
					gint _tmp49__length1 = 0;
					guint _tmp50_ = 0U;
					guint64 _tmp51_ = 0ULL;
					guint64* _tmp52_ = NULL;
					gint _tmp52__length1 = 0;
					guint _tmp53_ = 0U;
					guint64 _tmp54_ = 0ULL;
					gdouble _tmp55_ = 0.0;
					gdouble _tmp56_ = 0.0;
					_tmp42_ = _tmp41_;
					if (!_tmp42_) {
						guint _tmp43_ = 0U;
						_tmp43_ = i;
						i = _tmp43_ + 1;
					}
					_tmp41_ = FALSE;
					_tmp44_ = i;
					_tmp45_ = index;
					if (!(_tmp44_ < (_tmp45_ + 6))) {
						break;
					}
					_tmp46_ = provider_get_values (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PROVIDER, Provider), &_tmp46__length1);
					_tmp47_ = _tmp46_;
					_tmp47__length1 = _tmp46__length1;
					_tmp48_ = i;
					_tmp49_ = self->priv->newdata;
					_tmp49__length1 = self->priv->newdata_length1;
					_tmp50_ = i;
					_tmp51_ = _tmp49_[_tmp50_];
					_tmp52_ = self->priv->lastdata;
					_tmp52__length1 = self->priv->lastdata_length1;
					_tmp53_ = i;
					_tmp54_ = _tmp52_[_tmp53_];
					_tmp55_ = total;
					_tmp47_[_tmp48_] = (_tmp51_ - _tmp54_) / _tmp55_;
					_tmp56_ = _tmp47_[_tmp48_];
				}
			}
		}
	}
}


static guint64* _vala_array_dup3 (guint64* self, int length) {
	return g_memdup (self, length * sizeof (guint64));
}


static void cpu_provider_real_update (Provider* base) {
	CpuProvider * self;
	glibtop_cpu cpu = {0};
	glibtop_cpu _tmp0_ = {0};
	glibtop* _tmp1_ = NULL;
	gint _tmp2_ = 0;
	guint64* _tmp3_ = NULL;
	glibtop_cpu _tmp4_ = {0};
	guint64 _tmp5_ = 0ULL;
	glibtop_cpu _tmp6_ = {0};
	guint64 _tmp7_ = 0ULL;
	glibtop_cpu _tmp8_ = {0};
	guint64 _tmp9_ = 0ULL;
	glibtop_cpu _tmp10_ = {0};
	guint64 _tmp11_ = 0ULL;
	glibtop_cpu _tmp12_ = {0};
	guint64 _tmp13_ = 0ULL;
	glibtop_cpu _tmp14_ = {0};
	guint64 _tmp15_ = 0ULL;
	glibtop_cpu _tmp16_ = {0};
	guint64 _tmp17_ = 0ULL;
	guint64* _tmp54_ = NULL;
	gint _tmp54__length1 = 0;
	guint64* _tmp55_ = NULL;
	gint _tmp55__length1 = 0;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_CPU_PROVIDER, CpuProvider);
	glibtop_get_cpu (&_tmp0_);
	cpu = _tmp0_;
	_tmp1_ = glibtop_global_server;
	_tmp2_ = (*_tmp1_).ncpu;
	_tmp3_ = g_new0 (guint64, (_tmp2_ + 2) * 6);
	self->priv->newdata = (g_free (self->priv->newdata), NULL);
	self->priv->newdata = _tmp3_;
	self->priv->newdata_length1 = (_tmp2_ + 2) * 6;
	self->priv->_newdata_size_ = self->priv->newdata_length1;
	_tmp4_ = cpu;
	_tmp5_ = _tmp4_.user;
	_tmp6_ = cpu;
	_tmp7_ = _tmp6_.sys;
	_tmp8_ = cpu;
	_tmp9_ = _tmp8_.nice;
	_tmp10_ = cpu;
	_tmp11_ = _tmp10_.idle;
	_tmp12_ = cpu;
	_tmp13_ = _tmp12_.iowait;
	_tmp14_ = cpu;
	_tmp15_ = _tmp14_.irq;
	_tmp16_ = cpu;
	_tmp17_ = _tmp16_.softirq;
	cpu_provider_updatecpu (self, (guint) 0, _tmp5_, _tmp7_, _tmp9_, _tmp11_, (_tmp13_ + _tmp15_) + _tmp17_);
	{
		guint i = 0U;
		guint isize = 0U;
		glibtop* _tmp18_ = NULL;
		gint _tmp19_ = 0;
		i = (guint) 0;
		_tmp18_ = glibtop_global_server;
		_tmp19_ = (*_tmp18_).ncpu;
		isize = (guint) (_tmp19_ + 1);
		{
			gboolean _tmp20_ = FALSE;
			_tmp20_ = TRUE;
			while (TRUE) {
				gboolean _tmp21_ = FALSE;
				guint _tmp23_ = 0U;
				guint _tmp24_ = 0U;
				guint _tmp25_ = 0U;
				glibtop_cpu _tmp26_ = {0};
				guint64* _tmp27_ = NULL;
				gint _tmp27__length1 = 0;
				guint _tmp28_ = 0U;
				guint64 _tmp29_ = 0ULL;
				glibtop_cpu _tmp30_ = {0};
				guint64* _tmp31_ = NULL;
				gint _tmp31__length1 = 0;
				guint _tmp32_ = 0U;
				guint64 _tmp33_ = 0ULL;
				glibtop_cpu _tmp34_ = {0};
				guint64* _tmp35_ = NULL;
				gint _tmp35__length1 = 0;
				guint _tmp36_ = 0U;
				guint64 _tmp37_ = 0ULL;
				glibtop_cpu _tmp38_ = {0};
				guint64* _tmp39_ = NULL;
				gint _tmp39__length1 = 0;
				guint _tmp40_ = 0U;
				guint64 _tmp41_ = 0ULL;
				glibtop_cpu _tmp42_ = {0};
				guint64* _tmp43_ = NULL;
				gint _tmp43__length1 = 0;
				guint _tmp44_ = 0U;
				guint64 _tmp45_ = 0ULL;
				glibtop_cpu _tmp46_ = {0};
				guint64* _tmp47_ = NULL;
				gint _tmp47__length1 = 0;
				guint _tmp48_ = 0U;
				guint64 _tmp49_ = 0ULL;
				glibtop_cpu _tmp50_ = {0};
				guint64* _tmp51_ = NULL;
				gint _tmp51__length1 = 0;
				guint _tmp52_ = 0U;
				guint64 _tmp53_ = 0ULL;
				_tmp21_ = _tmp20_;
				if (!_tmp21_) {
					guint _tmp22_ = 0U;
					_tmp22_ = i;
					i = _tmp22_ + 1;
				}
				_tmp20_ = FALSE;
				_tmp23_ = i;
				_tmp24_ = isize;
				if (!(_tmp23_ < _tmp24_)) {
					break;
				}
				_tmp25_ = i;
				_tmp26_ = cpu;
				_tmp27_ = _tmp26_.xcpu_user;
				_tmp27__length1 = -1;
				_tmp28_ = i;
				_tmp29_ = _tmp27_[_tmp28_];
				_tmp30_ = cpu;
				_tmp31_ = _tmp30_.xcpu_sys;
				_tmp31__length1 = -1;
				_tmp32_ = i;
				_tmp33_ = _tmp31_[_tmp32_];
				_tmp34_ = cpu;
				_tmp35_ = _tmp34_.xcpu_nice;
				_tmp35__length1 = -1;
				_tmp36_ = i;
				_tmp37_ = _tmp35_[_tmp36_];
				_tmp38_ = cpu;
				_tmp39_ = _tmp38_.xcpu_idle;
				_tmp39__length1 = -1;
				_tmp40_ = i;
				_tmp41_ = _tmp39_[_tmp40_];
				_tmp42_ = cpu;
				_tmp43_ = _tmp42_.xcpu_iowait;
				_tmp43__length1 = -1;
				_tmp44_ = i;
				_tmp45_ = _tmp43_[_tmp44_];
				_tmp46_ = cpu;
				_tmp47_ = _tmp46_.xcpu_irq;
				_tmp47__length1 = -1;
				_tmp48_ = i;
				_tmp49_ = _tmp47_[_tmp48_];
				_tmp50_ = cpu;
				_tmp51_ = _tmp50_.xcpu_softirq;
				_tmp51__length1 = -1;
				_tmp52_ = i;
				_tmp53_ = _tmp51_[_tmp52_];
				cpu_provider_updatecpu (self, (_tmp25_ + 1) * 6, _tmp29_, _tmp33_, _tmp37_, _tmp41_, (_tmp45_ + _tmp49_) + _tmp53_);
			}
		}
	}
	_tmp54_ = self->priv->newdata;
	_tmp54__length1 = self->priv->newdata_length1;
	_tmp55_ = (_tmp54_ != NULL) ? _vala_array_dup3 (_tmp54_, _tmp54__length1) : ((gpointer) _tmp54_);
	_tmp55__length1 = _tmp54__length1;
	self->priv->lastdata = (g_free (self->priv->lastdata), NULL);
	self->priv->lastdata = _tmp55_;
	self->priv->lastdata_length1 = _tmp55__length1;
	self->priv->_lastdata_size_ = self->priv->lastdata_length1;
	self->priv->newdata = (g_free (self->priv->newdata), NULL);
	self->priv->newdata = NULL;
	self->priv->newdata_length1 = 0;
	self->priv->_newdata_size_ = self->priv->newdata_length1;
}


static void cpu_provider_class_init (CpuProviderClass * klass) {
	cpu_provider_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (CpuProviderPrivate));
	PROVIDER_CLASS (klass)->update = cpu_provider_real_update;
	G_OBJECT_CLASS (klass)->finalize = cpu_provider_finalize;
}


static void cpu_provider_instance_init (CpuProvider * self) {
	self->priv = CPU_PROVIDER_GET_PRIVATE (self);
}


static void cpu_provider_finalize (GObject* obj) {
	CpuProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_CPU_PROVIDER, CpuProvider);
	self->priv->lastdata = (g_free (self->priv->lastdata), NULL);
	self->priv->newdata = (g_free (self->priv->newdata), NULL);
	G_OBJECT_CLASS (cpu_provider_parent_class)->finalize (obj);
}


/******************************************************************************
 * Copyright (C) 2011-2013  Michael Hofmann <mh21@mh21.de>                    *
 *                                                                            *
 * This program is free software; you can redistribute it and/or modify       *
 * it under the terms of the GNU General Public License as published by       *
 * the Free Software Foundation; either version 3 of the License, or          *
 * (at your option) any later version.                                        *
 *                                                                            *
 * This program is distributed in the hope that it will be useful,            *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
 * GNU General Public License for more details.                               *
 *                                                                            *
 * You should have received a copy of the GNU General Public License along    *
 * with this program; if not, write to the Free Software Foundation, Inc.,    *
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.                *
 ******************************************************************************/
GType cpu_provider_get_type (void) {
	static volatile gsize cpu_provider_type_id__volatile = 0;
	if (g_once_init_enter (&cpu_provider_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (CpuProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) cpu_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CpuProvider), 0, (GInstanceInitFunc) cpu_provider_instance_init, NULL };
		GType cpu_provider_type_id;
		cpu_provider_type_id = g_type_register_static (TYPE_PROVIDER, "CpuProvider", &g_define_type_info, 0);
		g_once_init_leave (&cpu_provider_type_id__volatile, cpu_provider_type_id);
	}
	return cpu_provider_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



