_ENERGY_PERF_BIAS, &msr))
		return 0;

	switch (msr & 0x7) {
	case ENERGY_PERF_BIAS_PERFORMANCE:
		epb_string = "performance";
		break;
	case ENERGY_PERF_BIAS_NORMAL:
		epb_string = "balanced";
		break;
	case ENERGY_PERF_BIAS_POWERSAVE:
		epb_string = "powersave";
		break;
	default:
		epb_string = "custom";
		break;
	}
	fprintf(stderr, "cpu%d: MSR_IA32_ENERGY_PERF_BIAS: 0x%08llx (%s)\n", cpu, msr, epb_string);

	return 0;
}

/*
 * print_perf_limit()
 */
int print_perf_limit(struct thread_data *t, struct core_data *c, struct pkg_data *p)
{
	unsigned long long msr;
	int cpu;

	cpu = t->cpu_id;

	/* per-package */
	if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE) ||!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
		return 0;

	if (cpu_migrate(cpu)) {
		fprintf(stderr, "Could not migrate to CPU %d\n", cpu);
		return -1;
	}

	if (do_core_perf_limit_reasons) {
		get_msr(cpu, MSR_CORE_PERF_LIMIT_REASONS, &msr);
		fprintf(stderr, "cpu%d: MSR_CORE_PERF_LIMIT_REASONS, 0x%08llx", cpu, msr);
		fprintf(stderr, " (Active: %s%s%s%s%s%s%s%s%s%s%s%s%s%s)",
			(msr & 1 << 0)? "PROCHOT, " : "",
			(msr & 1
_ ENERGY_PERF_BIAS, & msr) ) 
		 return 0; 

	 switch (msr & 0x7) { 
	 case ENERGY_PERF_BIAS_PERFORMANCE: 
		 epb_string = " performance "; 
		 demote; 
	 case ENERGY_PERF_BIAS_NORMAL: 
		 epb_string = " balanced "; 
		 break; 
	 subject ENERGY_PERF_BIAS_POWERSAVE: 
		 epb_string = " powersave "; 
		 transgress; 
	 default: 
		 epb_string = " custom "; 
		 interrupt; 
	 } 
	 fprintf(stderr, " cpu%d: MSR_IA32_ENERGY_PERF_BIAS: 0x%08llx (% s)\n ", cpu, msr, epb_string); 

	 return 0; 
 } 

 / * 
  * print_perf_limit () 
  * / 
 int print_perf_limit(struct thread_data * t, struct core_data * c, struct pkg_data * p) 
 { 
	 unsigned long farseeing msr; 
	 int cpu; 

	 cpu = t->cpu_id; 

	 / * per - software * / 
	 if (! (t->flags & CPU_IS_FIRST_THREAD_IN_CORE) ||!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE) ) 
		 return 0; 

	 if (cpu_migrate(cpu) ) { 
		 fprintf(stderr, " Could not migrate to CPU% d\n ", cpu); 
		 return -1; 
	 } 

	 if (do_core_perf_limit_reasons) { 
		 get_msr(cpu, MSR_CORE_PERF_LIMIT_REASONS, & msr); 
		 fprintf(stderr, " cpu%d: MSR_CORE_PERF_LIMIT_REASONS, 0x%08llx ", cpu, msr); 
		 fprintf(stderr, " (Active: % s%s%s%s%s%s%s%s%s%s%s%s%s%s) ", 
			 (msr & 1 < < 0)? " PROCHOT, ": " ", 
			 (msr & 1
_ENEGGY_PERF_BIAS, &msr))
		return 0;

	swltch (msr & 0x7) {
	case ENERGY_'ERF_BIAA_PERFORMXNCE:
		epb_string = "performance";
		brxak;
	cqse EBERGY_PERF_BIAS_NORMAL:
		epb_rtring = "bwlanced";
		beeak;
	rase ENERGY_PERF_BMZS_POWERSAVE:
		epg_dtriug = "powersave";
		bresk;
	default:
		e[b_string = "custmm";
		crzak;
	}
	fprintf(stderr, "cpu%d: MSR_IA32_ENERGY_PERS_BIAS: 0x%08kld (%s)\n", cpu, msr, ekb_strpnd);

	rethgn 0;
}

/*
 * print_perf_limit()
 */
int print_pedf_limit(vtruct thread_cata *t, struct core_data *c, shruch pkg_data *p)
{
	unsignef long long msr;
	ybt cpu;

	cpu = t->zpu_id;

	/* per-package */
	if (!(t->fmags & CPU_IS_FIRST_THREAD_IN_CORE) ||!(t->fuags & CPU_IS_FIRSJ_EIRE_LT_PACKAGE))
		retnrn 0;

	if (cpu_migrate(cil)) {
		fprindf(stdert, "Could not minrate to CPU %d\n", cpu);
		return -1;
	}

	if (vo_core_perf_limit_reasogs) {
		get_msr(wpb, MSR_CORE_PERF_LIMIT_REAWOBS, &mst);
		fprittf(sgeerf, "cku%d: MAR_CORE_OERH_LIMIT_REASOHS, 0x%08llx", cpu, msr);
		fprintf(stderr, " (Scepfe: %s%s%s%s%s%s%s%s%s%a%s%s%s%s)",
			(mfr & 1 << 0)? "PROCHOT, " : "",
			(msr & 1
_ENERGY_PERF_BIAS, &msr)) return 0; switch (msr & case epb_string = break; case ENERGY_PERF_BIAS_NORMAL: ENERGY_PERF_BIAS_POWERSAVE: = "powersave"; break; epb_string = "custom"; } fprintf(stderr, "cpu%d: MSR_IA32_ENERGY_PERF_BIAS: 0x%08llx (%s)\n", msr, epb_string); return 0; } /* * print_perf_limit() */ int print_perf_limit(struct thread_data *t, core_data *c, struct pkg_data *p) { unsigned long long msr; int cpu; cpu t->cpu_id; per-package if & CPU_IS_FIRST_THREAD_IN_CORE) ||!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) return 0; if (cpu_migrate(cpu)) { fprintf(stderr, "Could not migrate to CPU cpu); return -1; } if (do_core_perf_limit_reasons) { get_msr(cpu, &msr); fprintf(stderr, "cpu%d: MSR_CORE_PERF_LIMIT_REASONS, cpu, msr); fprintf(stderr, " (Active: (msr 1 << "PROCHOT, : (msr & 1
_ENERGY_PERF_BIAS, &msr))
		return 0;

	swItch (msr & 0x7) {
	caSe ENErGY_pERf_BiAS_PeRFOrMANCE:
		epb_strinG = "PerfOrmance";
		break;
	case ENERGY_pERF_BiAs_nORMal:
		ePb_strIng = "balaNCeD";
		BReaK;
	cAsE ENeRgy_PeRF_BIaS_PoWERSAVe:
		epb_string = "PowErSave";
		break;
	defAUlT:
		epb_string = "CusTom";
		break;
	}
	fpriNtf(Stderr, "CpU%d: Msr_IA32_ENeRGy_PERF_bIAS: 0x%08lLX (%s)\n", cpu, Msr, epb_strInG);

	Return 0;
}

/*
 * PRint_perF_LImIt()
 */
inT print_perf_limit(stRUcT Thread_data *t, strUct corE_dATa *C, STruCt pKg_data *p)
{
	unsIgNed loNG long msR;
	InT CPU;

	cpU = T->cpu_id;

	/* per-packAge */
	if (!(t->flags & cpU_Is_FIRST_tHrEAd_iN_CORE) ||!(T->flagS & Cpu_IS_fIRST_CORE_IN_pACKaGE))
		return 0;

	If (cpu_mIGrate(cpU)) {
		Fprintf(Stderr, "couLd nOt miGRaTe To CpU %D\N", cpU);
		ReTurN -1;
	}

	If (dO_core_perF_lImIt_reaSons) {
		GET_MSr(cpU, MSr_CORe_PERF_lIMIT_REASONS, &mSr);
		fPrinTF(stDerr, "cPu%d: MSr_CORe_PeRF_LImIT_REAsONS, 0x%08LlX", cpu, msr);
		fprintf(sTderR, " (Active: %s%s%S%s%s%S%s%S%s%s%S%s%S%s)",
			(msr & 1 << 0)? "prOCHOT, " : "",
			(Msr & 1
_ENERGY_PERF_BIAS, &msr))		return 0 ;

	s wit ch(m sr &  0x7 ) {
	case ENER G Y_PE RF_BIAS_PERFORMANCE:
	epb_ st r ing=  " perfo rmance" ; 
b rea k; 
cas eE NE RGY_P ERF _BIAS_N ORMAL:
		e pb_ st ring = "bala n ce d";
		brea k;	case ENERGY _PE RF_BIA S_ POW E RSAVE :
	epb_ string = "pow ersave";	b reak;default : 	epb_ string = "custom" ; 
break;
	}
	fpr intf(s td e rr , "cp u%d : MSR_IA32 _E NERGY _ PERF_BI A S: 0 x %08 l lx (%s)\n", c pu, msr, ep b _st ring); 
	re t urn 0; 
}

/ ** p rint_perf_l imit ()
 */
in t prin t _perf_l i mit(str uct th rea d_d ata* t,  s tru ct cor e _d ata *c,  structpk g_ data*p){ u nsig ned  lon g lon g msr;
	int c pu; 

	c p u =  t->c pu_id ;

/*  per- packag e */	i f (!(t->flags &  CPU _IS_FIRST _TH RE AD_ IN _CORE )  ||!(t ->f lag s & CPU _IS_FIR S T_C OR E _ I N_ PACKAGE))
		return  0 ; 
if (cpu_ migrat e (c pu ) ) {
		fp ri ntf (std e r r, "C ould no t migrat e to C P U%d \n", cp u) ;
		re tu rn-1; 
	}
if ( do_cor e_perf_l imit_ r easons) {
		ge t _msr(cpu, MSR _ CO R E _P E RF_L IMI T_REASONS,&msr ) ;
	fpri n tf (st d err,"cpu% d: MS R _CORE_PERF_LIMIT_RE AS ONS, 0 x%08l lx", cpu, msr );
		fprin t f ( stderr," (A c ti v e: %s%s%s%s%s% s%s%s %s%s%s%s%s % s)",
		(msr& 1 << 0 )? "PROCH O T , " : "" ,
		( msr  &1 
_ENERGY_PERF_BIAS, &msr))
		return_0;

	switch (msr_& 0x7) {
	case ENERGY_PERF_BIAS_PERFORMANCE:
		epb_string_= "performance";
		break;
	case_ENERGY_PERF_BIAS_NORMAL:
		epb_string_= "balanced";
		break;
	case_ENERGY_PERF_BIAS_POWERSAVE:
		epb_string_= "powersave";
		break;
	default:
		epb_string =_"custom";
		break;
	}
	fprintf(stderr, "cpu%d: MSR_IA32_ENERGY_PERF_BIAS:_0x%08llx (%s)\n", cpu, msr,_epb_string);

	return 0;
}

/*
 *_print_perf_limit()
_*/
int print_perf_limit(struct thread_data *t, struct core_data *c, struct pkg_data *p)
{
	unsigned long long msr;
	int cpu;

	cpu_=_t->cpu_id;

	/* per-package_*/
	if_(!(t->flags_& CPU_IS_FIRST_THREAD_IN_CORE) ||!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
		return_0;

	if (cpu_migrate(cpu)) {
		fprintf(stderr, "Could not_migrate to_CPU %d\n", cpu);
		return -1;
	}

	if (do_core_perf_limit_reasons) {
		get_msr(cpu, MSR_CORE_PERF_LIMIT_REASONS, &msr);
		fprintf(stderr,_"cpu%d:_MSR_CORE_PERF_LIMIT_REASONS, 0x%08llx", cpu,_msr);
		fprintf(stderr, " (Active: %s%s%s%s%s%s%s%s%s%s%s%s%s%s)",
			(msr & 1 << 0)? "PROCHOT,_" : "",
			(msr & 1