약간 한물간 기술이긴 하지만, 아직도 Windows CE, Windows Mobile에서 개발하는 저와 같은 불쌍한 개발자들을 위한 팁입니다.
Analyzing Device Application Performance with the .Net Compact Framework Remote Performance Monitor
Installation
The .Net CF Remote Performance Monitor includes some files that reside on the desktop machine and some files that must be present on the device.
Installing the desktop components is easy - just run the SP1 setup program. After the installation completes, the RPM executable (netcfrpm.exe) is placed in the bin directory of Compact Framework SDK. On my machine, this directory is C:\Program Files\Microsoft.NET\SDK\CompactFramework\v2.0\bin.
Installing the device-side components involves manually copying two files from the desktop machine to the device. The SP1 setup program places the device-side files in the same directory as the cab file that matches your processor type and operation system version. I have a Pocket PC 2003 SE device, so my device-side components are installed in C:\Program Files\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE\wce400\armv4. The two files you must copy are netcfrtl.dll and netcflaunch.exe. Both of these files must be copied to the \windows directory of your device.
Installation Notes for Windows Mobile 5.0 Devices
There are two issues you may run into when installing the device-side RPM components on Windows Mobile 5.0 devices.
- Depending on the security configuration chosen by the device manufacturer, you may see a security prompt on the device the first time you launch the RPM. This prompt appears because netcfrpm.dll is not signed.
- An additional installation step is necessary on Windows Mobile 5.0 devices to provision the device so the RPM can run. Provisioning involves copying the following XML text into a file and using the rapiconfig utility to send the XML file to the device.
For example, if you pasted the above XML text into a file named rpmprov.xml you'd issue the following command from your desktop machine to provision your device:
rapiconfig /p rpmprov.xml
Launching the Remote Performance Monitor
To view dynamic performance statistics for your application, launch netcfrpm.exe from the desktop machine and select the "Live Counters...." option under the File menu. Doing so displays the following window:
Before you can view live statistics, you must connect the RPM to your device and specify the application you'd like to run. The instructions for connecting the RPM to your device vary based on whether the connection between your desktop machine and your device is via Active Sync or an Ethernet connection. If your connection is over ActiveSync, your device will automatically appear in the Device drop down in the RPM user interface. If your desktop machine is connected to the device through a direct network connection, you must know the IP address and port number through which the RPM can connect to your device. This information can be obtained by running netcflauch.exe from the \windows directory of your device. Running netcflaunch.exe displays the following:
Using the data displayed by netcflaunch.exe, enter the IP address and port number in format <IPAddress><single space><port number> in the Device drop down in the RPM user interface.
Before connecting to the device, you must specify the application you'd like to monitor using the Application text box. Be sure to type the fully qualified path name to the executable you wish to run on the device. For example, \Program Files\poomcominterop\poomcominterop.exe. If your applications takes command line parameters, you can specify them in the Parameters text box. If you need to specify more than one parameter, be sure to separate them with a space.
After you've selected the device to connect to, and specified the application to launch, click the Connect button in the lower right corner of RPM's user interface. The RPM will send a command to the device to remotely launch the application and start pulling back performance statistics. RPM displays the statistics in tabular form as shown in the following picture:
Again, a description of the various counters can be found on David Kline's blog.
Viewing Performance Statistics using Perfmon
While viewing performance statistics in RPM is useful, it's often easier to spot performance trends by viewing the data in a graphical form. The RPM enables you to view the statistics graphically by sending all the data it collects to the Windows Performance Monitor. After opening performance monitor, select the "Add Counter" option. In the dialog that is displayed you'll see counters corresponding to each category of performance statistic gathered by the RPM as show below:
After selecting the counters you'd like to view, the values for those counters appear as a line in the Perfmon graph. You may need to adjust the scale Perfmon uses to display a counter depending on the expected range of values. In the picture below I've chosen to view counters representing the size of the GC heap and the total number of bytes allocated while my application runs.
Other RPM Features
In addition to viewing performance statistics, the RPM also allows you to set various configuration options for your device. Selecting the Logging Options item from the Device menu displays the following dialog:
As you can see, the RPM allows you to configure the various types of logging done by the Compact Framework and to put your device into a state in which you can attach the debugger to any managed process. The following links provide more information about the various logging options:
영문은 쉽기 때문에 별도의 설명은 하지 않습니다...만은 혹시 영어를 싫어하시는 분들을 위해서..
0. Visual Studio 2003 이상의 개발툴은 당연히 깔려 있어야 하고, 개발에 필요한 PDA, 또는 스마트폰이 ActiveSync와 연결은 되어져 있어야 합니다.
1. C:\Program Files\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE\wce400\armv4. 에 있는 netcfrtl.dll과 netcflaunch.exe을 PDA의 windows폴더안에 복사합니다.
2. C:\Program Files\Microsoft.NET\SDK\CompactFramework\v2.0\bin 안에 있는 netcfrpm.exe 을 실행합니다.
3. Device에서 연결된 PDA를 선택하고 실행하고자 하는 프로그램의 정확한 경로를 Application안에 적어넣습니다. 필요한 파라미터가 있으면 Parameters안에 써넣습니다. 그리고 Connection버튼을 누르면 해당 프로그램이 실행되고 정보가 표시가 됩니다.
4. Performance Monitor를 통해서 그래프로 정보를 보고 싶으면 그래프 안에 "+" 또는 "Add"를 누르고 화면에서 잘 찾아서 선택하면 해당 정보가 그래프로 표시가 됩니다.