版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
WindowsEmbedded從 到精通系列課程
WindowsEmbeddedCE
Windows
調(diào)試與性能優(yōu)化
JianchaoTengConsultant
ConsultingServices
微軟中文技術(shù)
——
生活每一天
本周活動更新:
Top10
暢談我的2007
!
/
與眾不同:
版主:50+微軟最有價(jià)值專家(MVP)
涵蓋微軟幾乎所有產(chǎn)品線和知識庫
30+適合開發(fā)人員和IT專業(yè)人員技術(shù)板塊
本次課程內(nèi)容包括
CEand
ArchitectureOverview
DebuggingTips
Performance&Profiler
CEand Overview
MemoryLayout
Hint:RegisterWindow
WindowsCEVirtualMemoryReview
32-bitOS–
possible
TophalfusedbyKernel
BottomhalfusedbyUser
WindowsCEVirtualMemoryReview
Abovetheprocessslotsisasharedareaforlarge
VirtualAllocsandmemorymappedfiles
WindowsCEVirtualMemoryReview
32MBProcessslotstake
thelowestaddresses
Slot32
KernelSpae
Slot2
Slot1
UserProcessSpace
Slot0
ProcessSlot
0x01FFFFFF
DLLVirtualMemoryAllocations
RAMDLL+OverflowROMDLL:Code+Data
GeneralVirtualMemoryAllocations
ThreadStack
ThreadStack
0x00010000
GuardSection(64k)+UserKInfo
0x00000000
ProcessCode+Data
ProcessHeap
ProcessVirtualAlloc()calls
ROMDLLs:R/WData
32MBProcessslotissharedbyDLL,process,andallofitsvirtualallocations
Allvirtualallocationsare
64kB-aligned
Pagesmaybecommittedwithinavirtualallocationonapagegranularity(4kB)
DLLallocationsinaslotstartathighaddressesandgrowdown
Processandgeneralallocationsstartatlowaddressesandgrowup
9
Debuggingtips
Whatdowelearnfromthememorylayout?
HexAddressAnatomy
64KBalignment.
(VirtualAllocs,DLLalignment
andStackslot)
Hexaddresseshaveidentifiablepositions:
High/Low2GBUser“l(fā)essthan”8Kernel“greaterthan”8
MegabyteAlignment
PageAlign
Slotalignment
HexAddressAnatomy
Position1(inyellow) lsyouifitskernel
spaceoruserspace8andaboveiskernelBelow8isUserspace
HexAddressAnatomy
Position2(inred)isprocessslotpositionIfslotnumberisodd,address
islikelyaDLL
Ifslotnumberiseven,
addressislikelyanapp
Slot32
Slot2
Slot1
Slot0
HexAddressAnatomy
32MBinhexis:0x02000000
16MBUpper
32MBslot
MegabyteAlignment 16MBLower
HexAddressAnatomy
Position4(incyan)is64kbalignment
DLLalignment
Stackalignment
64KBalignment.(VirtualAllocs,DLLalignment
andStackslot)
HexAddressAnatomy
Position5(ingray)ispage(4kb)alignment
16pages==64kb
PageAlign
HexAddressAnatomy
64KBalignment.
(VirtualAllocs,DLLalignment
andStackslot)
Letstakeanotherlook
High/Low2GBUser“l(fā)essthan”8Kernel“greaterthan”8
MegabyteAlignment
PageAlign
Slotalignment
ThinkinginHexQuiz1
Whatisthedifferencebetween:
0x
and
0x0A119235??
Extracredit:Whatdoyouthinkitpointsto?
ThinkinginHex(Answer1)
Sameaddress!
Seconditisbeingviewedoutsidetsprocessslot.
0x
0x0A119235
1MB ppe
32MBslot
High/Low2GBUser“l(fā)essthan”8Kernel“greaterthan”8
0x
MegabyteAlignment
PageAlign
1 BLower
64KBalignment.(VirtualAllocs,DLLalignment
Slotalignment andStackslot)
“MostLikely”codeorglobal
ThinkinginHex(Quiz2)
?
Whatis:
0x019ABCDE
ThinkinginHex(Answer2)
0x019ABCDEis“mostlikely”
CODEfromaDLL.
16MBUppe
0x019ABCDE
6MBLowr
32MBslot
VisuallyDebuggingCallStacks
Stacksgrowfromhighertoloweraddresses
DefaultsizeofARMstackis64KBandtheyarealways
64KBaligned.Thismeansthatthe“topfunctions”of
astackwillbelocatedver closetoa64KBboundar.
WindowsCEalsoemlosthenotionoftwosearate
4KBguardpagesthatthrowexceptionsifentered
VisualStackInspection#1
StackPointer“dipped”intofirstguardpage
Stackoverflow
UnderstandingException
AKY"AccessKey“
PC
"ProgramCounter”
ESP/SP“StackPointer”
ESP-EA-RA-FSRareCPUspecifiedregisterorMMUregister
Backtoaddresstopic:0x f
Dataorcodefailed!
Usings
.exetocollect
runtimeInformation
gicommand
gi["proc","thrd","mod","all"]*["<pattern>"]:GetInformation
proc ->Listsallprocessesinthesystem
thrd ->Listsallprocesseswiththeirthreads
delta->ListsonlythreadsthathavechangesinCPUtimes
DEMO
TargetControlDebugging
ProfilerandOptimization
Optimizewhat?
Howcouldwecollectthe
runtimeinformation?
PerformanceOptimization
Whatisbottle-neckofthesystem?
WhichmodulecostmostCPUtime?
Beforeoptimizethesystem,Weneedtoknowhowdoesthesystemrunning
Whicheventcausesystemblocking?
KernelProfiler
Whatistheprofilermean?
DataCollection
TimeBased
– MonteCarlo(time-basedsampling)CallBased
SystemCalls(call-based)
MonteCarlo
Highresolutiontimerasthe“Hit”
InterruptstheOSperiodicallyandsamplesthePC
voidProfilerHit(DWORDra);
SystemCalls
hitsintheObjectCallfunctioninthekernel
SystemcallprofilingmonitorsthisObjectCallfunction
RemoteKerneltracker
CaptureOSeventsastheyhappen
Threadandprocesscreation/execution/PRIO
Synchronizationobjects
Interrupts
Memory,paging,TLBmisses
Loaderevents
Bootevents
ExaminingThreadBehavior
RemoteKerneltracker
DEMO
UsingRemoteKernelTracker
Profilingfunctioncall
PSLhappensonlyinAPIcall
Normallyfunctioncallwon’tcausePSL
Complieraddedfunctionbelowtotrackingfunctioncall
void stdcall_CAP_Enter_Function(void
*pfn);
void stdcall_CAP_Exit_Function(void*pfn);
ProfilingCode
RemoteCallProfiler
DEMO
UsingRemoteCallProfiler
Summary
Makeyourdevicebetter!
嵌入式開發(fā)資源
WindowsEmbedded中文
http:/ / /windows/embedded
.NETMicroFramework
http://m
/embedded/bb267253.aspx
RoboticsStudio
http://m
/robotics/default.aspx
微軟嵌入式開發(fā)者
/ /default.aspx?ForumGroupID=493&
SiteID=15
微軟中國嵌入式開發(fā)者博客
htt /yunxu/
MikeHall的博客
http://m /embedded/
Aa731228.aspx
微軟啟動新一輪“免費(fèi)重
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 黑龍江省-2024年-社區(qū)網(wǎng)格員-下半年筆試真題卷
- 智能電力系統(tǒng)的智慧解決方案
- 2024年幼兒園中秋節(jié)活動總結(jié)范例(3篇)
- 班組長安全生產(chǎn)責(zé)任制與職責(zé)模版(2篇)
- 2021年10月廣西南寧經(jīng)濟(jì)技術(shù)開發(fā)區(qū)勞務(wù)派遣人員公開招聘工作人員簡章(社會治安綜合管理辦公室)強(qiáng)化練習(xí)題(一)
- 高速公路施工安全管理制度樣本(3篇)
- 藥品召回管理制度與處置流程(3篇)
- 2024年車輛掛靠協(xié)議簡單版(4篇)
- 民爆行業(yè)安全管理制度樣本(三篇)
- 2024年學(xué)生會的講話演講范例(2篇)
- 2024年度醫(yī)療機(jī)構(gòu)照明燈具安裝外包協(xié)議
- 快手2025CNY《寨子里的歌晚》招商項(xiàng)目方案
- 靜療護(hù)士進(jìn)修匯報(bào)
- 2023年唐山銀行招聘考試真題
- 《小學(xué)低年級語文說話能力培養(yǎng)的研究》課題實(shí)施方案
- 大型機(jī)械運(yùn)輸服務(wù)方案
- 2024年異丁醛市場分析:異丁醛國內(nèi)市場復(fù)合年增長率約為7%
- 2024年公司工會工作計(jì)劃模版(三篇)
- 9.1增強(qiáng)安全意識課件-2024-2025學(xué)年統(tǒng)編版道德與法治七年級上冊
- 中國移動鐵通公司招聘筆試題庫2024
- 《鄒忌諷齊王納諫》課件
評論
0/150
提交評論