版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
WindowsEmbedded從 到精通系列課程
WindowsEmbeddedCE
Windows
調(diào)試與性能優(yōu)化
JianchaoTengConsultant
ConsultingServices
微軟中文技術(shù)
——
生活每一天
本周活動更新:
Top10
暢談我的2007
!
/
與眾不同:
版主:50+微軟最有價值專家(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
微軟啟動新一輪“免費重
溫馨提示
- 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)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 個人住房貸款擔(dān)保合同樣本
- 上海超市股份轉(zhuǎn)讓合同樣本
- 二手房買賣合同細則
- 產(chǎn)品銷售代理合同模板
- 個人汽車長期租賃合同
- 個人債務(wù)重組合同還款協(xié)議示例
- 個人入股合同書
- 上市公司員工股權(quán)激勵合同范本大全
- 個人財產(chǎn)轉(zhuǎn)讓合同示范文本
- 個體工商戶與合作方合作協(xié)議合同樣本
- 中考記敘文閱讀
- 《計算機應(yīng)用基礎(chǔ)》-Excel-考試復(fù)習(xí)題庫(含答案)
- 產(chǎn)科溝通模板
- 2023-2024學(xué)年四川省成都市小學(xué)數(shù)學(xué)一年級下冊期末提升試題
- GB/T 7462-1994表面活性劑發(fā)泡力的測定改進Ross-Miles法
- GB/T 2934-2007聯(lián)運通用平托盤主要尺寸及公差
- GB/T 21709.13-2013針灸技術(shù)操作規(guī)范第13部分:芒針
- 2022年青島職業(yè)技術(shù)學(xué)院單招語文考試試題及答案解析
- 急診科進修匯報課件
- 一年級家訪記錄表(常用)
- 信息技術(shù)基礎(chǔ)ppt課件(完整版)
評論
0/150
提交評論