miércoles, 22 de junio de 2011

CHAPTER 8 (IV)


There are some circumstances that might require you to control processes manually:
A single process is using too much processor time, slowing down other processes.
Applications are utilizing the processor fully, and you want one application to receive more or less processor time than other applications.
An application is not responding, and you want to end the applications processes forcibly.
The sections that follow show you how to accomplish each of these.
How to Identify Which Program Is Using the Most Processor Time
You can use Task Manager to identify a process that is using excessive processor time. Optionally, you can end the process forcibly by performing these steps:
1. Start Task Manager.
2. On the Processes tab, click the CPU column heading.
3. The process consuming the most processor time is shown at the top of the list.
4. With the busiest process identified, you can change the priority of the process (which might improve the performance of other applications), end the process, or limit the
process to specific processor cores by performing either of the following:
To change the priority of the process, right-click the process, select Set Priority, and then click the desired priority. Lower-priority processes receive less processor time, whereas higher-priority processes receive more processor time. Most processes run with Normal priority. Task Manager is a notable exception; it runs at High priority by default so that you can use it if another application is consuming significant amounts of processor time. Avoid giving any process Real-time priority, because it might slow the user interface.
By default, Windows can assign a process to run on any processor core. To limit the process to specific processor cores on a computer with multiple cores, right-click the process and then click Set Affinity. Figure 8-7 shows the Processor Affinity dialog box, which allows you to select which processor cores a process can use. Figure 8-7 shows Iexplore.exe (the Internet Explorer process) limited to two out of four processor cores, ensuring Internet Explorer never uses more than half the total processor time. Closing and restarting a process resets the processor affinity.

FIGURE 8-7 The Processor Affinity dialog box allows you to limit the processor cores on which a process can run.
To end the process, right-click the process and then click End Process. Alternatively, you can click End Process Tree to end any processes that process started.
How to Stop a Program
Occasionally, a program might not respond. Typically, you can right-click the application on the task bar and then click Close Window. In a few seconds, Windows prompts you to terminate the nonresponsive application.
If that approach does not work, you can use Task Manager to close an application as follows:
1. In Task Manager, on the Applications tab, select the application.
2. Click End Task.
3. If Task Manager cannot end the application, the End Program dialog box appears. Click End Now.
If you want to identify which process is associated with an application, right-click the application on the Applications tab, and then click Go To Process.
Performance Monitor
Like earlier versions of Windows, the Performance Monitor snap-in graphically displays real-time data, as shown in Figure 8-8.

FIGURE 8-8 How Performance Monitor shows real-time data
The sections that follow describe how to monitor real-time data, how to configure the Performance Monitor chart, and how to compare multiple graphs.
How to Monitor Real-Time Performance Data
To open Performance Monitor, follow these steps:
1. Click Start, right-click Computer, and then click Manage.
2. Expand System Tools, expand Performance, and then expand Monitoring Tools. Select Performance Monitor.
3. Add counters to the real-time graph by clicking the green plus button on the toolbar. You can also display data from other computers on the network.
Each line on the graph appears in a different color. To make it easier to view a specific graph, select a counter and press Ctrl+H. The selected counter appears bold and in black on the graph.
Performance Monitor automatically assigns line colors and styles to the counters you select. To configure line colors and styles manually, follow these steps:
1. Click the Action menu, and then click Properties. The Performance Monitor Properties dialog box appears.
2. Click the Data tab.
3. In the Counters list, select the counter you want to configure. Then, adjust the Color, Width, and Style settings.
4. To increase the height of the graph for a counter, click the Scale list and click a higher number. To decrease the height of a graph, click the Scale list and click a lower number.
5. You can also adjust the scale for all counters by clicking the Graph tab and changing the Maximum and Minimum values in the Vertical Scale group. Click OK. If you keep multiple Performance Monitor windows open simultaneously, you can make it easier to quickly distinguish between the windows by changing the background color on the chart using the Appearance tab in the Performance Monitor Properties dialog box.
How to Control How Much Data Appears in the Graph
By default, Performance Monitor updates the graphs once per second and displays 100 seconds of data. To display data over a longer period of time, you can increase the sampling interval or increase the amount of data displayed on the graph at once. To adjust these settings, follow these steps in Performance Monitor:
1. Click the Action menu, and then click Properties. The Performance Monitor Properties dialog box appears.
2. In the General tab, in the Graph Elements group, adjust the Sample Every box to change how frequently the graph updates. Use a longer interval (such as five seconds)  to show a smoother, less jagged graph that is updated less frequently. If you are connecting to a computer across a network, longer intervals reduce bandwidth usage.
3. Adjust the Duration box to change how much data is displayed in the graph before Performance Monitor begins overwriting the graph on the left portion of the chart. To display one full hour of data in the graph, set the duration to 3,600. To display one full day of data in the graph, set the duration to 86,400. If you increase the Duration box, you should also increase the Sample Every box. Click OK. By default, Performance Monitor begins overwriting graphed data on the left portion of the chart after the specified duration has been reached. When graphing data over a long period of time, it’s typically easier to see the chart scroll from right to left, similar to the way Task Manager shows data. To configure the Performance Monitor graph to scroll data, perform these steps:
1. Click the Action menu, and then click Properties. The Performance Monitor Properties dialog box appears.
2. Click the Graph tab. In the Scroll Style group, select Scroll. Click OK. Although the line chart shows the most information, you can select from the following chart types by clicking the Change Graph Type button on the toolbar or by pressing Ctrl+G:
Line The default setting, this shows values over time as lines on the chart.
Histogram bar This shows a bar graph with the most recent values for each counter displayed. If you have a large number of values and youre primarily interested in the current value (rather than the value of each counter over time), this will be easier to read than the line chart.
Report This text report lists each current value.
Data Collector Sets and Reports
Previous versions of Windows enabled you to log performance counter data and view it later. Windows Vista and Windows 7 greatly expand this capability. Now you can create a data collector set to log the following types of information:
Performance counters and alerts (just like in previous versions of Windows)
Event trace data showing detailed debugging information
Registry settings showing system and application configuration
After running a data collector set, you can view the performance counters in Performance Monitor and you can view a summary of the other collected information in a report.
The sections that follow describe how to create data collector sets and how to use reports.
Built-in Data Collector Sets
Windows 7 includes several built-in data collector sets located at Performance\Data Collector Sets\System:
System Performance Logs processor, disk, memory, and network performance counters and kernel tracing. Use this data collector set when troubleshooting a slow
computer or intermittent performance problems.
System Diagnostics Logs all the information included in the System Performance data collector set, plus detailed system information. Use this data collector set when troubleshooting reliability problems such as problematic hardware, driver failures, or Stop errors. As shown in Figure 8-9, the report generated by the data collector set provides a summary of error conditions on the system without requiring you to browse Event Viewer and Device Manager manually.

FIGURE 8-9 The System Diagnostics Report
To use a data collector set, right-click it, and then click Start. The System Performance data collector set stops automatically after a minute, and the System Diagnostics data collector set stops automatically after 10 minutes. To stop a data collector set manually, right-click it, and then click Stop.
After running a data collector set, you can view a summary of the data gathered in the Performance\Reports node. To view the most recent report for a data collector set, right-click the data collector set, and then click Latest Report. Reports are named automatically using the format <Computer_Name>_yyyymmdd-######.
To minimize the performance impact of data logging, log the least amount of information required. For example, you should use System Performance instead of System Diagnostics whenever possible because System Performance includes fewer counters.
When a problem is difficult to reproduce and is not performance-related, you should error on the side of logging too much data to minimize the chance that you will miss important information.
How to Create a Data Collector Set Using a Standard Template
You can save performance data to a log and then view and analyze the data in Performance Monitor at any time. It’s important to create a baseline by logging performance data before making changes that you think might have a performance impact. After making the changes, you can compare new performance data to the original performance data to determine whether your changes were beneficial. If you don’t have a baseline available when a problem appears, you can create one using a different computer with a similar configuration that does not have the problem.
To save performance data, follow these steps:
1. Under Performance, expand Data Collector Sets.
2. Right-click User Defined, click New, and then click Data Collector Set. The Create New Data Collector Set Wizard appears.
3. On the How Would You Like To Create This New Data Collector Set? page, type a name for the set. Make sure Create From A Template is selected. Then, click Next.
4. On the Which Template Would You Like To Use? page, choose from one of the three standard templates (or Browse to select a custom template) and click Next:
Basic Logs all Processor performance counters, stores a copy of the HKLM\ Software\Microsoft\Windows NT\Current Version registry key, and performs a Windows Kernel Trace.
System Diagnostics Logs 13 useful performance counters (including processor, disk, memory, and network counters), stores a copy of dozens of important configuration settings, and performs a Windows Kernel Trace. By default, System
Diagnostics logs data for one minute, giving you a snapshot of the computer’s status.
System Performance Logs 14 useful performance counters (including the same counters logged by the System Diagnostics template) and performs a Windows Kernel Trace. System Performance logs data for one minute.
5. On the Where Would You Like The Data To Be Saved? page, click Next to accept the default location for the data (%System drive%\Perfil ogs\Admin).
6. On the Create The Data Collector Set page, leave Run As set to <Default> to run it using the current user’s credentials, or click Change to specify other administrative
credentials. Select one of three options before clicking Finish:
Open Properties For This Data Collector Set Immediately customize the Data Collector Set.
Start This Data Collector Set Now Immediately begin logging data without customizing the Data Collector Set.
Save And Close Close the Data Collector Set without starting it. You can edit the properties and start it at any time after saving it. Custom data collector sets are always available under the User Defined node within Data Collector Sets.
How to Create a Custom Data Collector Set
After creating a new data collector set, you can modify it to log additional data sources by right-clicking the data collector set, clicking New, and then clicking Data Collector to open the Create New Data Collector wizard. On the What Type Of Data Collector Would You Like To Create? page, type a name for the data collector, select the type, and then click Next. You can choose from the following types of data collectors (each of which provides different options in the Create New Data Collector wizard):
Performance Counter Data Collector Logs data for any performance counter available when using the Performance Monitor console. You can add as many counters as you like to a data collector. You can assign a sample interval (15 seconds, by default) to the data collector.
Event Trace Data Collector Stores events from an event trace provider that match a particular filter. Windows 7 provides dozens of event trace providers that are capable of logging even the most minute aspects of the computer’s behavior. For best results, simply add all event trace providers that might relate to the problem you are troubleshooting. If the data collector logs a large amount of unnecessary data, you can use the provider properties to filter which trace events are stored.
Configuration Data Collector Stores a copy of specific registry keys, management paths, files, or the system state. If you are troubleshooting application problems or if you need to be aware of application settings, add the registry keys using a configuration data collector. To add a management path, file, or system state, create the data collector without specifying a registry key using the wizard. Then, view the new data collector properties, and select the Management Paths, File Capture, or State Capture tab.
Performance Counter Alert Generates an alert when a performance counter is above or below a specified threshold. You can add as many data collectors to a data collector set as required.
How to Save Performance Data
After creating a data collector set, you can gather the data specified in the Data Collector Set by right-clicking it and clicking Start. Depending on the settings configured in  he Stop Condition tab of the data collector set’s Properties dialog box, the logging might stop after a set amount of time or it might continue indefinitely. If it does not stop automatically, you can manually stop it by right-clicking it and clicking Stop.
How to View Saved Performance Data in a Report
After using a data collector set to gather information and then stopping the data collector set, you can view the gathered information. To view a summary of the data saved using a data collector set, right-click the data collector set and then click Latest Report. The console expands the Reports node and selects the report generated when the data collector set ran. You can expand each section to find more detailed information. If the data collector set included performance counters, you can also view them using the
Performance Monitor snap-in by following these steps:
1. Under Performance, expand Monitoring Tools, and then select Performance Monitor.
2. Click the Action menu, and then click Properties. In the Performance Monitor Properties dialog box, click the Source tab. You can also click the View Log Data button on the toolbar or press Ctrl+L.
3. Under Data Source, select Log Files. Then, click Add. By default, Windows 7 stores data collector set data in the C:\Perfl ogs\ folder. Browse to select the data collector set  data (the folder corresponds to the report name), and then click Open.
4. If you want, click Time Range and narrow the range of data you want to analyze.
5. Click OK.
6. In Performance Monitor, click the green Add button on the toolbar and add counters to the chart. Because you specified a data source, you can add only counters that were
logged.
7. Performance Monitor shows the logged data instead of real-time data. To narrow the time range shown, click and drag your cursor over the graph to select a time range.
Then, right-click the graph and click Zoom To, as shown in Figure 8-10.
8. The horizontal bar beneath the graph illustrates the currently selected time range. Drag the left and right sides of the bar to expand the selected time range. Then,
right-click the graph and click Zoom To again to change the selection.

FIGURE 8-10 Using the Zoom To feature to analyze a narrow time span
Troubleshooting Disk Performance Problems
For many common tasks on a computer, the hard disk limits overall performance. Opening and saving files requires reading from and writing to the hard disk, which is much slower than accessing system RAM. In addition, if Windows needs to allocate more memory than it has physical RAM available, Windows uses the hard disk as virtual memory, reducing performance for any task that requires the memory stored on the hard disk. Fortunately, there are several things you can do to improve performance without upgrading to a faster hard disk. The sections that follow discuss fragmentation and virtual memory.
Fragmentation and Free Space
To reduce fragmentation, increase the amount of free disk space. When a disk begins to run out of space, Windows needs to divide files into several different fragments, a process known as fragmentation. Because hard disks perform best when a file is not fragmented, fragmentation slows disk performance. As a general rule, you should keep at least 15 percent of a disk’s space free, but having more free disk space can further improve performance.
NOTE
FRAGMENTATION AND FLASH DRIVES
Traditional, magnetic hard disks have a drive head that must move across several spinning round platters to read data, much like a record player. These drives perform best when reading and writing sequentially, which does not require the drive head to move to a different part of the disk. To read a fragmented file, the drive head must move several times, slowing performance. Flash drives do not have a drive head, and fragmentation does not reduce their performance. Therefore, you never have to worry about fragmentation with a flash drive. Windows 7 automatically disables defragmentation for flash drives.
You can use the Windows 7 Disk Cleanup tool to free up disk space automatically by following these steps:
1. Click Start, and then click Computer.
2. Right-click the drive you want to clean, and then click Properties.
3. On the General tab, click Disk Cleanup.
4. To remove system files (a task that requires administrative privileges), click Clean Up System Files.
5. Select the files that you want to delete. You can click each file type for a description of the files that will be removed. Click OK.
The Disk Cleanup tool removes the files you specified. Windows 7 automatically defragments your files, so you should never need to defragment manually. If you would like to defragment files manually, perform these steps:
1. Click Start, and then click Computer.
2. Right-click the drive you want to defragment, and then click Properties.
3. On the Tools tab, click Defragment Now.
4. To configure the defragmentation schedule, click Configure Schedule.
5. In the Disk Defragmenter tool, select the disk you want to defragment, and then click Defragment Disk. The Disk Defragmenter begins defragmenting the drive. You don’t have to wait for it to complete before closing the window, however.
6. Click Close, and then click OK.
Virtual Memory
Depending on the disk configuration, you can maximize the performance of virtual memory by storing virtual memory on a different physical hard disk from other files. For example, if a computer has a separate C: and D: drive, Windows by default uses the C: drive for virtual memory. By moving the virtual memory to the D: drive, Windows might be able to read and write files stored on the C: drive at the same time it accesses virtual memory.

No hay comentarios:

Publicar un comentario