<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>WOW, very very interesting results ...</span></div><div><span>Thanks.</span></div><div><span><br></span></div><div><span>BogDan.</span></div><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "><div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "><font size="2" face="Arial"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> "thomas.senyk@nokia.com" <thomas.senyk@nokia.com><br><b><span style="font-weight: bold;">To:</span></b> bog_dan_ro@yahoo.com; necessitas-devel@kde.org<br><b><span style="font-weight: bold;">Sent:</span></b> Thursday, July 14, 2011 6:30 PM<br><b><span style="font-weight: bold;">Subject:</span></b> RE:
atomics<br></font><br>There you go<br><br>Not sure what will happen with the names of the files, so:<br>...galax~1.log is: galaxy tab10" <br>...galax~2.log is: galaxy s2<br><br>________________________________________<br>From: ext BogDan [<a ymailto="mailto:bog_dan_ro@yahoo.com" href="mailto:bog_dan_ro@yahoo.com">bog_dan_ro@yahoo.com</a>]<br>Sent: Thursday, July 14, 2011 3:53 PM<br>To: BogDan; Senyk Thomas (Nokia-DXM/Munich); <a ymailto="mailto:necessitas-devel@kde.org" href="mailto:necessitas-devel@kde.org">necessitas-devel@kde.org</a><br>Subject: Re: atomics<br><br>One more thing, "int atomic_xxxxxx" must NOT be inline functions because it will break the ABI !<br><br>BogDan.<br><br><br><br>>________________________________<br>>From: BogDan <<a ymailto="mailto:bog_dan_ro@yahoo.com" href="mailto:bog_dan_ro@yahoo.com">bog_dan_ro@yahoo.com</a>><br>>To: "<a ymailto="mailto:thomas.senyk@nokia.com"
href="mailto:thomas.senyk@nokia.com">thomas.senyk@nokia.com</a>" <<a ymailto="mailto:thomas.senyk@nokia.com" href="mailto:thomas.senyk@nokia.com">thomas.senyk@nokia.com</a>>; "<a ymailto="mailto:necessitas-devel@kde.org" href="mailto:necessitas-devel@kde.org">necessitas-devel@kde.org</a>" <<a ymailto="mailto:necessitas-devel@kde.org" href="mailto:necessitas-devel@kde.org">necessitas-devel@kde.org</a>><br>>Sent: Thursday, July 14, 2011 4:46 PM<br>>Subject: Re: atomics<br>><br>><br>>Sorry :)<br>>Attached !<br>><br>><br>>BogDan.<br>><br>><br>><br>>>________________________________<br>>>From: "<a ymailto="mailto:thomas.senyk@nokia.com" href="mailto:thomas.senyk@nokia.com">thomas.senyk@nokia.com</a>" <<a ymailto="mailto:thomas.senyk@nokia.com" href="mailto:thomas.senyk@nokia.com">thomas.senyk@nokia.com</a>><br>>>To: <a ymailto="mailto:bog_dan_ro@yahoo.com"
href="mailto:bog_dan_ro@yahoo.com">bog_dan_ro@yahoo.com</a>; <a ymailto="mailto:necessitas-devel@kde.org" href="mailto:necessitas-devel@kde.org">necessitas-devel@kde.org</a><br>>>Sent: Thursday, July 14, 2011 4:38 PM<br>>>Subject: RE: atomics<br>>><br>>>The whitespaces and everything seams to be quite broken in<br>your code-past :)<br>>><br>>>Could you create a projects, tar it and send it as attachment? This would help a lot and more people will be willing to run it :)<br>>><br>>>Greets<br>>>Thomas<br>>>________________________________________<br>>>From: ext BogDan [<a ymailto="mailto:bog_dan_ro@yahoo.com" href="mailto:bog_dan_ro@yahoo.com">bog_dan_ro@yahoo.com</a>]<br>>>Sent: Friday, July 08, 2011 3:33 PM<br>>>To: <a ymailto="mailto:necessitas-devel@kde.org" href="mailto:necessitas-devel@kde.org">necessitas-devel@kde.org</a><br>>>Subject:
atomics<br>>><br>>>Hello Folks,<br>>><br>>>I've made a small application to test current available atomic implementations on android.<br>>>This are the results on a HTC sensation device:<br>>><br>>><br>>>Test 1<br>>>===============================<br>>>USING SMP safe ASM instructions<br>>>--------------------------------------------------------------------<br>>>Executing test_atomic_cmpxchg_ASM took 14714<br>>>Executing test_atomic_cmpxchg_GCC took 15685<br>>>Executing<br>test_atomic_cmpxchg_Android took 8874<br>>>Executing test_atomic_inc_ASM took 14310<br>>>Executing test_atomic_inc_GCC took 16190<br>>>Executing test_atomic_inc_Android took 8351<br>>>===============================<br>>>Test 2<br>>>===============================<br>>>USING SMP unsafe ASM
instructions<br>>>--------------------------------------------------------------------<br>>>Executing test_atomic_cmpxchg_ASM took 6904<br>>>Executing test_atomic_cmpxchg_GCC took 15814<br>>>Executing test_atomic_cmpxchg_Android took 8864<br>>>Executing test_atomic_inc_ASM took 6404<br>>>Executing test_atomic_inc_GCC took 16048<br>>>Executing test_atomic_inc_Android took 8198<br>>>===============================<br>>><br>>><br>>><br>>>And this is
the<br>code:<br>>><br>>>#include<QDebug><br>>>#include<QDateTime><br>>>#include<sys/atomics.h><br>>>staticconstintLOOPS=100000000;<br>>>#defineSMP_SAFE<br>>>#ifdefSMP_SAFE<br>>>#definesmp_mb__asm____volatile__("dmb":::"memory")<br>>>#else<br>>>#definesmp_mb<br>>>#endif<br>>>intatomic_cmpxchg(int&_q_value,intexpectedValue,intnewValue)<br>>>{<br>>>registerintresult;<br>>>smp_mb;<br>>>asmvolatile("0:\n"<br>>>"ldrex%[result],[%[_q_value]]\n"<br>>>"eors%[result],%[result],%[expectedValue]\n"<br>>>"itteq\n"<br>>>"strexeq%[result],%[newValue],[%[_q_value]]\n"<br>>>"teqeq%[result],#1\n"<br>>>"beq0b\n"<br>>>:[result]"=&r"(result),<br>>>"+m"(_q_value)<br>>>:[expectedValue]"r"(expectedValue),<br>>>[newValue]"r"(newValue),<br>>>[_q_value]"r"(&_q_value)<br>>>:"cc");<br>&
gt;>smp_mb;<br>>>returnresult==0;<br>>>}<br>>>voidtest_atomic_cmpxchg_ASM()<br>>>{<br>>>inttest=0;<br>>>for(inti=0;i<LOOPS;i++)<br>>>{<br>>>atomic_cmpxchg(test,test,test+1);<br>>>}<br>>>qDebug()<<test;<br>>>}<br>>>voidtest_atomic_cmpxchg_GCC()<br>>>{<br>>>inttest=0;<br>>>for(inti=0;i<LOOPS;i++)<br>>>{<br>>>__sync_bool_compare_and_swap(&test,test,test+1);<br>>>}<br>>>qDebug()<<test;<br>>>}<br>>>voidtest_atomic_cmpxchg_Android()<br>>>{<br>>>inttest=0;<br>>>for(inti=0;i<LOOPS;i++)<br>>>{<br>>>__atomic_cmpxchg(test,test+1,&test);<br>>>}<br>>>qDebug()<<test;<br>>>}<br>>>intatomic_inc(int&_q_value,intvalueToAdd)<br>>>{<br>>>registerintoriginalValue;<br>>>registerintnewValue;<br>>>registerintresult;<br>>>smp_mb;<
br>>>asmvolatile("0:\n"<br>>>"ldrex%[originalValue],[%[_q_value]]\n"<br>>>"add%[newValue],%[originalValue],%[valueToAdd]\n"<br>>>"strex%[result],%[newValue],[%[_q_value]]\n"<br>>>"teq%[result],#0\n"<br>>>"bne0b\n"<br>>>:[originalValue]"=&r"(originalValue),<br>>>[newValue]"=&r"(newValue),<br>>>[result]"=&r"(result),<br>>>"+m"(_q_value)<br>>>:[valueToAdd]"r"(valueToAdd),<br>>>[_q_value]"r"(&_q_value)<br>>>:"cc");<br>>>smp_mb;<br>>>returnoriginalValue;<br>>>}<br>>>voidtest_atomic_inc_ASM()<br>>>{<br>>>inttest=0;<br>>>intlast=0;<br>>>for(inti=<br>0;i<LOOPS;i++)<br>>>{<br>>>last=atomic_inc(test,1);<br>>>}<br>>>qDebug()<<test<<last;<br>>>}<br>>>voidtest_atomic_inc_GCC()<br>>>{<br>>>inttest=0;<br>>>intlast=0;<br>>>for(inti=0;i<LOOPS;i++)<br>>
;>{<br>>>last=__sync_fetch_and_add(&test,1);<br>>>}<br>>>qDebug()<<test<<last;<br>>>}<br>>>voidtest_atomic_inc_Android()<br>>>{<br>>>inttest=0;<br>>>intlast=0;<br>>>for(inti=0;i<LOOPS;i++)<br>>>{<br>>>last=__atomic_inc(&test);<br>>>}<br>>>qDebug()<<test<<last;<br>>>}<br>>>voidtestAtomics()<br>>>{<br>>>#ifdefSMP_SAFE<br>>>qDebug()<<"USINGSMPsafeASMinstructions";<br>>>#else<br>>>qDebug()<<"USINGSMPunsafeASMinstructions";<br>>>#endif<br>>>QDateTimestart=QDateTime::currentDateTimeUtc();<br>>>test_atomic_cmpxchg_ASM();<br>>>qDebug()<<"Executingtest_atomic_cmpxchg_ASMtook"<<start.msecsTo(QDateTime::currentDateTimeUtc());<br>>>start=QDateTime::currentDateTimeUtc();<br>>>test_atomic_cmpxchg_GCC();<br>>>qDebug()<<"Executingtest_atomic_c
mpxchg_GCCtook"<<start<br>.msecsTo(QDateTime::currentDateTimeUtc());<br>>>start=QDateTime::currentDateTimeUtc();<br>>>test_atomic_cmpxchg_Android();<br>>>qDebug()<<"Executingtest_atomic_cmpxchg_Androidtook"<<start.msecsTo(QDateTime::currentDateTimeUtc());<br>>>start=QDateTime::currentDateTimeUtc();<br>>>test_atomic_inc_ASM();<br>>>qDebug()<<"Executingtest_atomic_inc_ASMtook"<<start.msecsTo(QDateTime::currentDateTimeUtc());<br>>>start=QDateTime::currentDateTimeUtc();<br>>>test_atomic_inc_GCC();<br>>>qDebug()<<"Executingtest_atomic_inc_GCCtook"<<start.msecsTo(QDateTime::currentDateTimeUtc());<br>>>start=QDateTime::currentDateTimeUtc();<br>>>test_atomic_inc_Android();<br>>>qDebug()<<"Executingtest_atomic_inc_Androidtook"<<start.msecsTo(QDateTime::currentDateTimeUtc());<br>>>}<br>>><br>>><br>>>Please try this
code on a different devices and post the results here.<br>>><br>>>Thanks,<br>>>BogDan.<br>>>_______________________________________________<br>>>Necessitas-devel mailing<br>list<br>>><a ymailto="mailto:Necessitas-devel@kde.org" href="mailto:Necessitas-devel@kde.org">Necessitas-devel@kde.org</a><br>>><a href="https://mail.kde.org/mailman/listinfo/necessitas-devel" target="_blank">https://mail.kde.org/mailman/listinfo/necessitas-devel</a><br>>><br>>><br>>><br>>_______________________________________________<br>>Necessitas-devel mailing list<br>><a ymailto="mailto:Necessitas-devel@kde.org" href="mailto:Necessitas-devel@kde.org">Necessitas-devel@kde.org</a><br>><a href="https://mail.kde.org/mailman/listinfo/necessitas-devel" target="_blank">https://mail.kde.org/mailman/listinfo/necessitas-devel</a><br>><br>><br>><br><br><br></div></div></blockquote></div></div></body></html>