embedded從入門到精通系列課程4windows ce5.0mobile調(diào)試與性能優(yōu)化_第1頁
embedded從入門到精通系列課程4windows ce5.0mobile調(diào)試與性能優(yōu)化_第2頁
embedded從入門到精通系列課程4windows ce5.0mobile調(diào)試與性能優(yōu)化_第3頁
embedded從入門到精通系列課程4windows ce5.0mobile調(diào)試與性能優(yōu)化_第4頁
embedded從入門到精通系列課程4windows ce5.0mobile調(diào)試與性能優(yōu)化_第5頁
已閱讀5頁,還剩39頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論