03.08.2013 Views

Decorated Operations for QorIQ P3/P4/P5 Processors - Freescale ...

Decorated Operations for QorIQ P3/P4/P5 Processors - Freescale ...

Decorated Operations for QorIQ P3/P4/P5 Processors - Freescale ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Sample Application<br />

volatile int32_t *decorated_counter = NULL;<br />

volatile int32_t lock_counter = 0;<br />

__PERCPU volatile int32_t private_counter = 0;<br />

void singlecore_test(void)<br />

{<br />

uint32_t i;<br />

atb_start = mfspr(SPR_ATBL); //start timer<br />

atb_stop = mfspr(SPR_ATBL); //stop timer<br />

atb_oh = atb_stop - atb_start;<br />

APP_INFO ("Start/Stop overhead is %d cycles.", atb_oh);<br />

atb_oh=4;<br />

atb_start = mfspr(SPR_ATBL); //start timer<br />

decorated_notify_inc_32(decorated_counter);<br />

atb_stop = mfspr(SPR_ATBL); //stop timer<br />

APP_INFO ("1 Decoration took %d cycles.", atb_stop-atb_start - atb_oh);<br />

atb_start = mfspr(SPR_ATBL); //start timer<br />

<strong>for</strong>(i=0; i < 10; i++){<br />

decorated_notify_inc_32(decorated_counter);<br />

}<br />

atb_stop = mfspr(SPR_ATBL); //stop timer<br />

APP_INFO ("10 Decorations took %d cycles.", atb_stop-atb_start - atb_oh);<br />

atb_start = mfspr(SPR_ATBL); //start timer<br />

<strong>for</strong>(i=0; i < 1; i++){<br />

spin_lock(&sync_lock);<br />

lock_counter+=i;<br />

spin_unlock(&sync_lock);<br />

}<br />

atb_stop = mfspr(SPR_ATBL); //stop timer<br />

APP_INFO ("1 lock counter took %d cycles.", atb_stop-atb_start - atb_oh);<br />

<strong>Decorated</strong> <strong>Operations</strong> <strong>for</strong> <strong>QorIQ</strong> <strong>P3</strong>/<strong>P4</strong>/<strong>P5</strong> <strong>Processors</strong>, Rev. A<br />

10 <strong>Freescale</strong> Confidential Proprietary <strong>Freescale</strong> Semiconductor<br />

Preliminary—Subject to Change Without Notice

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!