Ch3_PerfSysProgramming.pdf
(
2686 KB
)
Pobierz
MCTS
Exam 70-571
i
Windows Embedded CE 6.0
Preparation Kit
Self-Paced Training
Up to Date
with
R2
Content
Not for Resale.
2
first top-level entry
Contents at a Glance
1
Customizing the Operating System Design
2
Building and Deploying the Run-Time Image
3
Performing System Programming
4
Debugging and Testing the System
5
Customizing a Board Support Package
6
Developing Device Drivers
Chapter 3
Performing System Programming
System performance is critical for user productivity. It directly influences the user’s
perception of a device. In fact, it is not uncommon for users to judge the usefulness of
a device based on the performance of the system and the look and feel of the user
interface. By providing too complex of an interface, you can confuse users and open
your device to potential security risks or unexpected user manipulations. By using the
incorrect APIs, or incorrect applications architecture in a multithreaded environment,
you may significantly impact performance. Performance optimization and system
customization are real challenges for firmware providers. This chapter discusses the
tools and highlights best practices to achieve optimal system response times on target
devices.
Exam objectives in this chapter:
Monitoring and optimizing system performance
■
Implementing system applications
■
Programming with threads and thread synchronization objects
■
Implementing exception handling in drivers and applications
■
Supporting power management at the system level
■
Before You Begin
To complete the lessons in this chapter, you must have the following:
A thorough understanding of real-time systems design concepts, such as
scheduler functionality in an operating system, interrupts, and timers.
■
Basic knowledge of multithreaded programming, including synchronization
objects.
■
A development computer with Microsoft® Visual Studio® 2005 Service Pack 1
and Platform Builder for Microsoft Windows® Embedded CE 6.0 installed.
■
81
82
Chapter 3
Performing System Programming
Lesson 1: Monitoring and Optimizing
System Performance
Performance monitoring and optimization are important tasks in the development of
small-footprint devices. The need for optimized system performance remains critical
because of an ever-growing number of increasingly complex applications and the
requirement for intuitive and therefore resource-intensive user interfaces.
Performance optimization requires firmware architects and software developers to
constrain resource consumption within their system components and applications so
that other components and applications can use the available resources. Whether
developing device drivers or user applications, optimized processing algorithms can
help to save processor cycles, and efficient data structures can preserve memory.
Tools exist at all system levels to identify performance issues within and between
drivers, applications, and other components.
After this lesson, you will be able to:
■
Identify the latency of an interrupt service routine (ISR).
■
Improve the performance of a Windows Embedded CE system.
■
Log and analyze system performance information.
Estimated lesson time: 20 minutes.
Real-Time Performance
Drivers, applications, and OEM adaptation layer (OAL) code impact system and real-
time performance. Although Windows Embedded CE may be used in real-time and
non-real-time configurations, it is important to note that using non-real-time
components and applications can decrease system performance in a real-time
operating system (OS) configuration. For example, you should keep in mind that
demand paging, device input/output (I/O), and power management are not designed
for real-time devices. Use these features carefully.
Demand Paging
Demand paging facilitates memory sharing between multiple processes on devices
with limited RAM capacity. When demand paging is enabled, Windows Embedded
CE discards and removes memory pages from active processes under low-memory
conditions. However, to keep the code of all active processes in memory, disable
83
Lesson 1: Monitoring and Optimizing System Performance
demand paging for the entire operating system or for a specific module, such as a
dynamic-link library (DLL) or device driver.
You can disable demand paging by using the following methods:
■
Operating system
Edit the Config.bib file and set the ROMFLAGS option in
the CONFIG section.
■
DLLs
Use the LoadDriver function instead of the LoadLibrary function to load
the DLL into memory.
■
Device drivers
Add the DEVFLAGS_LOADLIBRARY flag to the Flags registry
entry for the driver. This flag causes Device Manager to use the LoadLibrary
function instead of the LoadDriver function to load the driver.
Windows Embedded CE allocates and uses memory as usual, but does not discard it
automatically when you disable demand paging.
System Timer
The system timer is a hardware timer that generates system ticks at a frequency of one
tick per millisecond. The system scheduler uses this timer to determine which
threads should run at what time on the system. A thread is the smallest executable
unit within a process that is allocated processor time to execute instructions in the
operating system. You can stop a thread for an amount of time by using the Sleep
function. The minimum value that you can pass to the Sleep function is 1 (
Sleep(1)
),
which stops the thread for approximately 1 millisecond. However, the sleep time is
not exactly 1 millisecond because the sleep time includes the current system timer
tick plus the remainder of the previous tick. The sleep time is also linked to the
priority of the thread. The thread priority determines the order in which the operating
system schedules the threads to run on the processor. For those reasons, you should
not use the Sleep function if you need accurate timers for real-time applications. Use
dedicated timers with interrupts or multimedia timers for real-time purposes.
Power Management
Power management can affect system performance. When the processor enters the
Idle power state, any interrupt generated by a peripheral or the system scheduler
causes the processor to exit this state, restore the previous context, and invoke the
scheduler. Power context switching is a time-consuming process. For detailed
information about the power management features of Windows Embedded CE, see
the section “Power Management” in the Windows Embedded CE 6.0 documentation
Plik z chomika:
finka15
Inne pliki z tego folderu:
WindowsEmbeddedCE.zip
(9175 KB)
SCRZ.zip
(8656 KB)
WindowsEmbeddedCE Fundamentals.PDF
(9699 KB)
wykład 3.ppt
(3105 KB)
windowsce_480272.c
(774 KB)
Inne foldery tego chomika:
Algorytmy kwantowe
Algorytmy optymalizacji
Analiza i modelowanie SI
Analiza strukturalna SI
Architektura korporacyjna
Zgłoś jeśli
naruszono regulamin