embedded从入门到精通系列课程4windows ce5.0mobile调试与性能优化_第1页
embedded从入门到精通系列课程4windows ce5.0mobile调试与性能优化_第2页
embedded从入门到精通系列课程4windows ce5.0mobile调试与性能优化_第3页
embedded从入门到精通系列课程4windows ce5.0mobile调试与性能优化_第4页
embedded从入门到精通系列课程4windows ce5.0mobile调试与性能优化_第5页
免费预览已结束,剩余39页可下载查看

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论