Linux Profiling on MID

Article | Discussion | View source | History |

From MIDWiki

Contents

Linux Profiling on MID


Profiling Tools

oprofile

Oprofile is a tool for system wide profiling. It can list both processes and modules, as well as the kernel itself, and also supports gathering performance monitor events from IA chipsets (the latest they have is Pentium M, so we still need to add the new Silverthorne events). To run it, Enable CONFIG_PROFILING=y and CONFIG_OPROFILE=m in the kernel config (as well as debug info if possible), copy the vmlinux uncompressed kernel to /boot on the target, and install oprofile. This can be done with yum install oprofile on FC6 systems. The developer site is at http://oprofile.sourceforge.net)

strace

Strace traces through syscalls, each of which trigger an interrupt and a switch to and from kernel space, thus they take alot of time and should be reduced if possible. It can be installed via yum install strace on FC6 machines.

Statmonitor

System monitoring utility, written in plain C. Allows application execution and performance monitoring, saving results into XML files. Monitors CPU, memory, network and disk usage on a per-application or per-system basis. (http://sourceforge.net/projects/statmonitor)

VTune

VTune is an advanced user side debug and profiler tool which can break down execution and trace by library, file, function, etc. It is designed to help optimize applications. (http://www3.intel.com/cd/software/products/asmo-na/eng/239145.htm).

Systemtap

SystemTap provides a simple command line interface and scripting language for writing instrumentation for a live running kernel. We are publishing samples, as well as enlarging the internal "tapset" script library to aid reuse and abstraction. We also plan to support probing userspace applications. We are investigating interfacing Systemtap with similar tools such as Frysk, Oprofile and LTT. (http://sourceware.org/systemtap/)

/Proc Filesystem

Processor Function Tools Using It Data Provided
/proc/stat statmonitor, appr, bltk user, niced, and system processes executed per cpu since boot
idle, iowait, irq service, and softirq service time since boot (in ticks)
interrupt counts for each irq type since boot
context switch count since boot
seconds since boot
processes currently running and those currently blocked due to iowait
/proc/diskstats statmonitor, appr, bltk For each mounted image:
number of reads issued
number of reads merged
number of writes merged
number of sectors read
number of milliseconds spent reading [[BR]number of writes completed
number of sectors written
number of milliseconds spent writing
number of I/Os currently in progress
number of milliseconds spent doing I/Os
weighted number of milliseconds spent doing I/Os
/proc/cmdline bltk The command line parameters passed to vmlinuz during boot
/proc/config.gz bltk Contains a gzipped copy of the config file used to build the kernel
/proc/cpuinfo bltk processor, vendor_id, cpu family, model, model name, stepping, cpu MHz, cache size
/proc/interrupts bltk Interrupt list with counts since boot, for example:
timer, i8042, rtc, acpi, i8042, ide0, uhci_hcd:usb3, ehci_hcd:usb1,
uhci_hcd:usb2, uhci_hcd:usb4, uhci_hcd:usb5, sdhci:slot0, HDA Intel
/proc/meminfo bltk Virtual and physical memory page counts
/proc/modules bltk List of active modules (accessed by lsmod)
/proc/partitions bltk List of actively mounted hard disks
/proc/swaps bltk List of actively mounted swap partitions
/proc/version bltk Shows the kernel version and its build info (accessed by uname -a)
/proc/vmstat bltk virtual and physical memory page stats
/proc/net/dev statmonitor, appr information about the configured network interfaces
Used by network administrators to view the status of the network
/proc/<pid>/stat statmonitor, appr Process statistics including execution time, sleep time,
memory stats, and interrupt stats (accessed by ps)
/proc/<pid>/status strace, appr Same info as /proc/<pid>/stat but in readable form
/proc/<pid>/ctl strace, appr A write-only file to which structured messages are written directing the
system to change some aspect of the process's state or control its behavior in some way.
These can include PCSTOP, PCRUN, PCSTRACE, PCSKILL, PCSHOLD , etc.
/proc/<pid>/as strace, appr Used to read and/or write from/to the process's address space
/proc/<pid>/mem strace, appr Description of the memory map held by the process
/proc/<pid>/regs strace, appr Lists various CPU registers such as the frame and stack pointers
These are dumped when a fault occurs
/proc/acpi/alarm bltk Interface to the Real Time Clock (RTC). It is written to schedule an alarm
that will generate a hardware wake event when in the sleeping state.
Reading it shows the currently set alarm time
/proc/acpi/ac_adapter bltk A directory which contains state files for each detectable AC adapter.
The adapter name corresponds to its entry in the BIOS's DSDT file
The state file shows whether it is attached or not (i.e. whether the platform
is running on battery or not)
/proc/acpi/battery bltk A directory which contains state, info, and alarm files for each detectable Battery.
The battery name corresponds to its entry in the BIOS's DSDT file
The state file shows the battery's connection status, capacity, charging status,
charging rate, it's remaining capacity, and it's current voltage.
The info file gives the battery's design specifications and model info
The alarm file shows the status of the battery's low power alarm (if available)
/proc/acpi/processor bltk This is the interface to each processor's voltage and frequency scaling controls.


Kernel Command Line Arguments

Parameter Config Dependencies Description
acpi_dbg_layer=<int> CONFIG_ACPI Each bit of the <int> indicates an ACPI debug layer,
1: enable, 0: disable. It is useful for boot time
debugging. After system has booted up, it can be set
via /proc/acpi/debug_layer.
acpi_dbg_level=<int> CONFIG_ACPI Each bit of the <int> indicates an ACPI debug level,
1: enable, 0: disable. It is useful for boot time
debugging. After system has booted up, it can be set
via /proc/acpi/debug_level.
profile Enable kernel profiling via /proc/profile
Format: [schedule,]<number>
Param: "schedule" - profile schedule points.
Param: <number> - step/bucket size as a power of 2 for
statistical time based profiling.
Param: "sleep" - profile D-state sleeping (millisecs)
prof=sleep CONFIG_PROFILING causes the kernel to profile the amount of
time spent in uninterruptible sleeps.


Hardware Performance Monitor Events

http://oprofile.sourceforge.net/docs/intel-p6-mobile-events.php3