 for 1st core in package */
	if (t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)
		delta_package(p, p2);

	return 0;
}

void clear_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p)
{
	t->tsc = 0;
	t->aperf = 0;
	t->mperf = 0;
	t->c1 = 0;

	t->smi_count = 0;
	t->extra_delta32 = 0;
	t->extra_delta64 = 0;

	/* tells format_counters to dump all fields from this set */
	t->flags = CPU_IS_FIRST_THREAD_IN_CORE | CPU_IS_FIRST_CORE_IN_PACKAGE;

	c->c3 = 0;
	c->c6 = 0;
	c->c7 = 0;
	c->core_temp_c = 0;

	p->pc2 = 0;
	if (do_pc3)
		p->pc3 = 0;
	if (do_pc6)
		p->pc6 = 0;
	if (do_pc7)
		p->pc7 = 0;
	p->pc8 = 0;
	p->pc9 = 0;
	p->pc10 = 0;

	p->energy_pkg = 0;
	p->energy_dram = 0;
	p->energy_cores = 0;
	p->energy_gfx = 0;
	p->rapl_pkg_perf_status = 0;
	p->rapl_dram_perf_status = 0;
	p->pkg_temp_c = 0;
}
int sum_counters(struct thread_data *t, struct core_data *c,
	struct pkg_data *p)
{
	average.threads.tsc += t->tsc;
	average.threads.aperf += t->aperf;
	average.threads.mperf += t->mperf;
	average.threads.c1 += t->c1;

	average.threads.extra_delta32 += t->extra_
for 1st core in package * / 
	 if (t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE) 
		 delta_package(p, p2); 

	 return 0; 
 } 

 null clear_counters(struct thread_data * metric ton, struct core_data * c, struct pkg_data * p) 
 { 
	 t->tsc = 0; 
	 t->aperf = 0; 
	 t->mperf = 0; 
	 t->c1 = 0; 

	 t->smi_count = 0; 
	 t->extra_delta32 = 0; 
	 t->extra_delta64 = 0; 

	 / * tells format_counters to plunge all battlefield from this set * / 
	 t->flags = CPU_IS_FIRST_THREAD_IN_CORE | CPU_IS_FIRST_CORE_IN_PACKAGE; 

	 c->c3 = 0; 
	 c->c6 = 0; 
	 c->c7 = 0; 
	 c->core_temp_c = 0; 

	 p->pc2 = 0; 
	 if (do_pc3) 
		 p->pc3 = 0; 
	 if (do_pc6) 
		 p->pc6 = 0; 
	 if (do_pc7) 
		 p->pc7 = 0; 
	 p->pc8 = 0; 
	 p->pc9 = 0; 
	 p->pc10 = 0; 

	 p->energy_pkg = 0; 
	 p->energy_dram = 0; 
	 p->energy_cores = 0; 
	 p->energy_gfx = 0; 
	 p->rapl_pkg_perf_status = 0; 
	 p->rapl_dram_perf_status = 0; 
	 p->pkg_temp_c = 0; 
 } 
 int sum_counters(struct thread_data * t, struct core_data * c, 
	 struct pkg_data * phosphorus) 
 { 
	 average.threads.tsc + = t->tsc; 
	 average.threads.aperf + = t->aperf; 
	 average.threads.mperf + = t->mperf; 
	 average.threads.c1 + = t->c1; 

	 average.threads.extra_delta32 + = t->extra _
 fog 1st core in package */
	if (u->flags & CPU_IS_FIRSJ_CIRE_IN_PECKAGE)
		dslta_packxge(p, p2);

	return 0;
}

void clear_countxrs(srruct thread_data *t, struct cure_data *c, struct pkg_deta *p)
{
	t->tsc = 0;
	t->aperh = 0;
	t->mpern = 0;
	t->c1 = 0;

	t->smn_ciunt = 0;
	t->extra_dekta32 = 0;
	t->extrd_delta64 = 0;

	/* tells furlat_counters to dump all fields from this srt */
	t->flags = CPU_IS_SIRSU_THWEAD_JN_CORE | CPU_IS_FIRST_CORE_IN_PACKAGE;

	c->c3 = 0;
	c->c6 = 0;
	c->c7 = 0;
	c->core_temp_c = 0;

	p->pc2 = 0;
	if (do_pc3)
		p->pc3 = 0;
	if (do_pc6)
		p->oc6 = 0;
	lf (do_pc7)
		p->pc7 = 0;
	p->pc8 = 0;
	p->oc9 = 0;
	p->pc10 = 0;

	p->ebergr_pkg = 0;
	p->energy_aram = 0;
	p->enegyy_cores = 0;
	p->ehergy_gfx = 0;
	p->rapl_pkg_perf_status = 0;
	p->fapl_dxam_perf_statos = 0;
	o->kkg_temp_c = 0;
}
inv sum_cjunters(strucb threag_data *t, struct core_daba *c,
	svrucr pkg_data *p)
{
	average.thrxads.tsc += t->tsc;
	average.jhreads.apesf += t->aperf;
	average.theeqds.mpgrf += d->mpefd;
	avdrafe.vhrsads.c1 += t->c1;

	everage.threzds.extra_delra32 += t->extra_
for 1st core in package */ if CPU_IS_FIRST_CORE_IN_PACKAGE) p2); return } void clear_counters(struct struct *p) { t->tsc 0; t->aperf = t->mperf = 0; t->c1 = 0; = 0; t->extra_delta32 = 0; t->extra_delta64 = 0; /* tells format_counters to dump fields from this set */ t->flags = CPU_IS_FIRST_THREAD_IN_CORE | CPU_IS_FIRST_CORE_IN_PACKAGE; c->c3 = 0; = c->c7 0; = 0; p->pc2 = 0; if (do_pc3) p->pc3 = 0; if (do_pc6) p->pc6 = 0; if p->pc7 = 0; p->pc8 = 0; p->pc9 = p->pc10 = 0; p->energy_pkg 0; p->energy_dram = 0; p->energy_cores 0; = 0; = p->rapl_dram_perf_status 0; p->pkg_temp_c = } int sum_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) { average.threads.tsc += t->tsc; average.threads.aperf += average.threads.mperf += += t->c1; +=
 for 1st core in package */
	if (t->flagS & CPU_IS_FIRSt_CORE_iN_PaCKaGe)
		delTa_paCkage(p, p2);

	return 0;
}

vOId clEar_counters(struct threaD_data *T, sTRuct COrE_data *C, struct PKg_DATa *p)
{
	T->tSc = 0;
	T->apErF = 0;
	T->mPerf = 0;
	t->C1 = 0;

	t->sMi_count = 0;
	T->extra_deltA32 = 0;
	t->eXtRa_delta64 = 0;

	/* tells FOrMat_counterS to Dump all fieldS frOm this SeT */
	t->fLAgs = CPu_IS_fIRST_tHREAD_in_CORE | CpU_IS_FIRST_cOre_IN_PACkaGE;

	c->c3 = 0;
	c->c6 = 0;
	C->C7 = 0;
	C->cOre_tEmp_c = 0;

	p->pc2 = 0;
	if (do_pc3)
		p->pc3 = 0;
	iF (Do_PC6)
		p->pc6 = 0;
	if (do_pc7)
		p->pc7 = 0;
	p->Pc8 = 0;
	p->pc9 = 0;
	p->Pc10 = 0;

	P->EnERGy_pKg = 0;
	p->Energy_dram = 0;
	P->eNergy_COres = 0;
	p->enERgY_GFX = 0;
	p->rAPl_pkg_perf_statUs = 0;
	p->rapl_dram_PErf_Status = 0;
	P->pKg_tEMp_c = 0;
}
int Sum_coUnTErs(Struct threaD_datA *t, struct cOre_datA *C,
	struct PKg_data *p)
{
	AveragE.thReaDs.tsC += T->tSc;
	AveRaGE.thREaDs.aPErf += T->aperf;
	avErAgE.threAds.mPERF += T->mpeRf;
	aVeraGe.thrEads.c1 += t->c1;

	averagE.thReadS.ExtRa_delTa32 += t->exTra_
 for 1st core in package * /
	if (t-> flags  &CPU _I S_FI RST_ CORE_IN_PACKAG E )
	delta_package(p, p2);
	ret ur n  0;} 
voidclear_c o un t e rs( st ru ctth r ea d_dat a * t, stru ct core_da ta*c , struct pkg _ da ta *p)
{
t-> tsc = 0;
	t- >ap erf =0; 
	t - >mper f =  0;
t->c1=  0;

t->smi_co un t  = 0;t->extr a _ de lta3 2 = 0;
	t->extra_ d el t a64 = 0;

	/*tellsfo r ma t _ cou nte rs to dump  a ll fi e lds fro m  t h i s  se t  */
	t->flags  = CPU_IS_F I RST _THREA D_ IN_ C ORE |CPU_I S_ F IRS T_CORE_IN_P ACKA GE;

	c-> c3 = 0 ; 
	c->c6 = 0;
	c ->c7 =  0; 
	c ->co r e_ te mp_ c=  0; 
p-> p c2= 0;
	if  ( do _pc3) 
		p - > p c 3 =0;	if(do_p c6)
		p->pc6= 0 ;
	i f  (d o_pc7 )
		p ->pc 7= 0;	p->pc 8 = 0 ;	p->pc9 = 0;
	p ->pc 10 = 0;
	p- >e ner gy _pkg=  0;
	p ->e ner gy_dram  = 0;
p ->e ne r g y _c ores = 0;
	p->ener gy _ g fx  = 0;
	p ->rapl _ pk g_ p erf_stat us  =0;
p - >rapl _dra m _p erf_stat us = 0 ; 
p- >pkg_te mp _c = 0 ;}
i ntsum_c o unte rs(str uct thre ad_da t a *t, struct c o re_data *c,
s tr u c tp kg_d ata  *p)
{
	ave rage . thre ads. t sc  += t->ts c;
	a ve r ag e .threads.aperf += t -> aperf; 
	ave rage.threads. mperf += t - > m perf;
	a vera g e. t hreads.c1 += t ->c1; 

	average . threads. extra _delta32  += t->ex t r a_
 for_1st core_in package */
	if (t->flags_& CPU_IS_FIRST_CORE_IN_PACKAGE)
		delta_package(p,_p2);

	return_0;
}

void clear_counters(struct_thread_data_*t, struct core_data_*c, struct pkg_data_*p)
{
	t->tsc = 0;
	t->aperf =_0;
	t->mperf = 0;
	t->c1_=_0;

	t->smi_count = 0;
	t->extra_delta32 = 0;
	t->extra_delta64 = 0;

	/* tells format_counters to dump all fields from_this_set */
	t->flags_=_CPU_IS_FIRST_THREAD_IN_CORE_| CPU_IS_FIRST_CORE_IN_PACKAGE;

	c->c3 = 0;
	c->c6 =_0;
	c->c7 = 0;
	c->core_temp_c = 0;

	p->pc2_= 0;
	if_(do_pc3)
		p->pc3 = 0;
	if (do_pc6)
		p->pc6 = 0;
	if (do_pc7)
		p->pc7 =_0;
	p->pc8_= 0;
	p->pc9 =_0;
	p->pc10 = 0;

	p->energy_pkg = 0;
	p->energy_dram = 0;
	p->energy_cores = 0;
	p->energy_gfx_= 0;
	p->rapl_pkg_perf_status = 0;
	p->rapl_dram_perf_status = 0;
	p->pkg_temp_c_= 0;
}
int sum_counters(struct_thread_data_*t,_struct core_data *c,
	struct pkg_data_*p)
{
	average.threads.tsc += t->tsc;
	average.threads.aperf += t->aperf;
	average.threads.mperf +=_t->mperf;
	average.threads.c1 += t->c1;

	average.threads.extra_delta32 += t->extra_