付费下载
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
WindowsEmbedded从 到精通系列课程
WindowsEmbeddedCE
Windows
调试与性能优化
JianchaoTengConsultant
ConsultingServices
微软中文技术
——
生活每一天
本周活动更新:
Top10
畅谈我的2007
!
/
与众不同:
版主:50+微软最有价值专家(MVP)
涵盖微软几乎所有产品线和知识库
30+适合开发人员和IT专业人员技术板块
本次课程内容包括
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“lessthan”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“lessthan”8Kernel“greaterthan”8
MegabyteAlignment
PageAlign
Slotalignment
ThinkinginHexQuiz1
Whatisthedifferencebetween:
0x
and
0x0A119235??
Extracredit:Whatdoyouthinkitpointsto?
ThinkinginHex(Answer1)
Sameaddress!
Seconditisbeingviewedoutsidetsprocessslot.
0x
0x0A119235
1MB ppe
32MBslot
High/Low2GBUser“lessthan”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!
嵌入式开发资源
WindowsEmbedded中文
http:/ / /windows/embedded
.NETMicroFramework
http://m
/embedded/bb267253.aspx
RoboticsStudio
http://m
/robotics/default.aspx
微软嵌入式开发者
/ /default.aspx?ForumGroupID=493&
SiteID=15
微软中国嵌入式开发者博客
htt /yunxu/
MikeHall的博客
http://m /embedded/
Aa731228.aspx
微软启动新一轮“免费重
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 陶瓷贴花工成果转化竞赛考核试卷含答案
- 旅游业客户满意度提升策略研究手册
- 河南省平顶山市鲁山县第七教研区2026-2027学年九年级上学期9月阶段检测语文试题(含答案)
- 工业机器人控制系统集成设计手册
- 广东省惠州市惠州中学2026-2027年高三上9月月考英语试卷(含解析)
- 销售经理绩效评定考核维度分析表
- 轻烃回收装置操作工保密考核试卷含答案
- 石材加工工成果考核试卷含答案
- 无线电设备运维员技术操作能力考核试卷含答案
- 氮化钛涂层工岗位实操知识能力考核试卷含答案
- 职业病防治之高处坠落预防专题
- 课件-刘海湘直播-新增值税申报表体系精讲与风险管控
- 高一信息技术《计算机解决问题的过程》教学设计
- IPC-JEDEC J-STD-005B-2022 中文版(焊锡膏的要求和测试方法)
- 新生儿颅内出血护理查房
- 2026年物流RFID技术应用师考试题库及答案
- 部编版六年级上册语文1-8单元基础知识默写填空专项训练(含答案)
- 建筑结构健康监测技术规程
- 遵义会议放光辉合唱简谱
- 《新污染物治理技术》-课件 第1章 新污染物简介
- wedo自动投篮机课件
评论
0/150
提交评论