1.centos简介
2.å¦ä½ä½¿ç¨oprofile对软件åprofiling
centos简介
CentOS是源码一个基于Red Hat Linux提供并可自由使用的源代码的企业级Linux发行版。其最新版本为CentOS 6.4,分析该版本于年7月9日发布。源码而Red Hat Enterprise Linux (RHEL) 6.4则于年2月日发布,分析增强选时 指标源码其速度相对较快。源码在RHEL 6.4中,分析主要改进包括支持Parallel NFS (pNFS),源码增强对Vmware和Hyper-V虚拟机的分析支持及性能,安全增强了身份管理,源码支持cgroups(及PMU),分析以及更多的源码手游分包助手源码新工具等。 每个版本的分析CentOS都会获得长达十年的支持,通过安全更新方式实现。源码新版本的分析CentOS大约每两年发行一次,每个版本则定期(每六个月)更新一次,源码以支持新的平台任务发布源码系统硬件。这样的更新策略有助于建立一个安全、低维护、稳定、高预测性、高重复性的稳赢选股公式源码Linux环境。 CentOS的全称是Community Enterprise Operating System,它是由RHEL源代码再编译而成,且在RHEL的基础上修正了大量已知的Bug,因此其稳定性得到了广泛的认可。RHEL在发行时有两种方式:二进制的html我的家乡源码发行方式和源代码的发行方式。无论是哪种方式,用户都可以免费获取(例如通过网络下载),但若使用在线升级(包括补丁)或咨询服务,则需付费。 对于CentOS爱好者和学习者来说,CentOS中文论坛是一个聚集地,是国内专门讨论CentOS技术的论坛,提供了一个交流和学习的平台。扩展资料
CentOS(Community ENTerprise Operating System)是Linux发行版之一,它是来自于Red Hat Enterprise Linux依照开放源代码规定释出的源代码所编译而成。由于出自同样的源代码,因此有些要求高度稳定性的服务器以CentOS替代商业版的Red Hat Enterprise Linux使用。两者的不同,在于CentOS并不包含封闭源代码软件。å¦ä½ä½¿ç¨oprofile对软件åprofiling
ããå ³äºXilinx Zynq-带æ¥çæ°çç³»ç»è®¾è®¡æè·¯ï¼ä»¥åProfilingç对象libjpegï¼åæå·²ç»æè¿°è¿äºï¼åæ¤ä¸åèµè¿°ã
ããä¸. Oprofileç®ä»
ããProfilingæ¯å¯¹ä¸åæ§è½ç¹å¾çæ°æ®çå½¢å¼åæ»ç»æåæï¼å®é常以å¾å½¢å表çå½¢å¼åºç°ãå®æä¾ä¸ºç¹å®çå¤çå¨äºä»¶æ¶éçéæ ·ç¾åæ°ææ° éï¼æ¯å¦cache miss rateãTLB miss rateççãä¸è¬æ¥è¯´ï¼ä¸»è¦ç®çæ¯ä¸ºäºæ¾åºè½¯ä»¶ä¸çæ§è½ç¶é¢ï¼ç¶åæé对æ§çä¼å以æå软件çæ´ä½æ§è½ã
ããOprofile æ¯ç¨äº Linux çè¥å¹²ç§è¯æµåæ§è½çæ§å·¥å ·ä¸çä¸ç§ãå®å¯ä»¥å·¥ä½å¨ä¸åçä½ç³»ç»æä¸ï¼å æ¬ARM, PowerPC, MIPS, IA, IA å AMD Athlonççãå®çå¼éå¾å°ï¼ä»Linux 2.6 çèµ·ï¼å®è¢«å å«è¿äºLinuxå æ ¸ä¸ã
ããOprofileå¯ä»¥æ¶éæå ³å¤çå¨äºä»¶çä¿¡æ¯ï¼å¸®å©ç¨æ·è¯å«è¯¸å¦å¾ªç¯çå±å¼ãcacheç使ç¨çä½ãä½æçç±»å转æ¢ååä½æä½ãé误é¢æµè½¬ç§» çé®é¢ãOprofileæ¯ä¸ç§ç»ç²åº¦çå·¥å ·ï¼å¯ä»¥ä¸ºæ令éæè 为å½æ°ãç³»ç»è°ç¨æä¸æå¤çä¾ç¨æ¶ééæ ·ãOprofile éè¿åæ ·æ¥å·¥ä½ã使ç¨æ¶éå°çè¯æµæ°æ®ï¼ç¨æ·å¯ä»¥å¾å®¹æå°æ¾åºæ§è½é®é¢ã
ããéè¿çå¯CPUçhardware eventsï¼oprofileå¯ä»¥å¨è¿è¡ç¶æä¸å¯¹æ´ä¸ªLinuxç³»ç»è¿è¡profilingãProfilingç对象å¯ä»¥æ¯Linux kernel (å æ¬modulesåinterrupt handlers), shared librariesæè åºç¨ç¨åºã
ããä»0.9.8çæ¬å¼å§ï¼oprofileæ¯æPerf_events profiling mode模å¼ãåºç¨ç¨åºoperf被ç¨æ¥æ§å¶profilingè¿ç¨;èå¨legacy modeä¸ï¼æ¯éè¿opcontrolèæ¬åoprofiled daemonæ¥å®æçãOperfä¸å象legacy modeé£æ ·éè¦OProfile kernel driverï¼å®ç´æ¥åLinux Kernel Performance Events Subsystemæ交éã使ç¨operfï¼å°±å¯ä»¥ç¨æ®éç¨æ·ç身份æ¥profilingç¨æ·çåºç¨ç¨åºäºï¼å½ç¶å¦æéè¦å¯¹æ´ä¸ªç³»ç»æ¥profiling çæ¶åè¿æ¯éè¦rootæéçã
ããå¦æ硬件ä¸æ¯æOProfile使ç¨performance countersï¼OProfileå°±åªè½å·¥ä½å¨Timer Modeä¸äºãTimer Modeåªè½å¨legacy profiling modeä¸ä½¿ç¨ï¼å³åªè½éè¿opcontrolèæ¬æ¥æ§å¶ã
ããOprofileçwebsite为ï¼piled (JIT) code
ãã? å¯ä»¥å¯¹æ´ä¸ªç³»ç»åprofiling
ãã? å¯ä»¥è§å¯CPUå é¨çç»èï¼ä¾å¦cache miss rate
ãã? å¯ä»¥å¤æºä»£ç åannotation
ãã? å¯ä»¥æ¯æinstruction-levelçprofiling
ãã? å¯ä»¥çæcall-graph profiles
ããä¸è¿OProfileä¹ä¸æ¯ä¸è½çï¼å®ä¹æèªå·±çå±éæ§ï¼
ãã? åªè½å¨x, ARM, åPowerPCæ¶æä¸çæcall graph profiles
ãã? ä¸æ¯æ%精确çinstruction-level profiling
ãã? 对dynamically compiled (JIT) code profilingçæ¯æè¿ä¸å®åã
ããæ 论å¦ä½ï¼Oprofileçåè½é½æ¯gprofè¦å¼ºå¾å¤ï¼ä»£ä»·æ¯é 置起æ¥ä¼æ¯è¾éº»ç¦ã
ããäº. ç¼è¯Oprofile
ããé¦å æ好å¨Linux kerneléé¢éä¸Oprofile driverï¼ä»¥è·å¾å ¨é¢çæ¯æã
ããä¸è½½Linux kernel Sourceï¼ä»/Xilinx/linux-xlnx å¯ä»¥ä¸è½½å°Xilinxæä¾çéªè¯å¥½çå æ ¸ãå¦æä¸æ¹ä¾¿ä½¿ç¨Linuxä¸çgitå·¥å ·ï¼å¯ä»¥åå»é¡µé¢ä¸çreleasesæ¾å°ç¸åºççæ¬ä¸è½½tar ballãä¸è½½çæ¶åæ好étar.gzæ ¼å¼çï¼èä¸æ¯zipæ ¼å¼çï¼å 为åè å¨å¤çsymbol linkçæ¶åæå¯è½ä¼åºé®é¢ã
ããå 为ç¬è 使ç¨çæ¯Xilinx Linux pre-built .7ï¼æ以è¿éä¸è½½çæ¯linux-xlnx-xilinx-v.7.tar.gz
ãã解å缩åï¼ç¨ä»¥ä¸å½ä»¤è°åºLinux kernelçé ç½®çé¢ï¼
ããexport ARCH=arm
ããexport CROSS_COMPILE=arm-xilinx-linux-gnueabi-
ããmake xilinx_zynq_defconfig
ããmake xconfig æè make menuconfig
ããå¨é ç½®çé¢ä¸å°ä»¥ä¸ä¸¤é¡¹å¾ä¸ï¼
ããGeneral setup --->
ãã[*] Profiling support
ãã<*> OProfile system profiling
ããç¶åmake uImageå³å¯çææ°çuImageï¼ç¨æ¥æ¿æ¢Xilinx Linux pre-built .7ä¸çLinux kernel imageãåæ¶æ们ä¹éè¦vmlinuxæ¥æ£æ¥profilingçç»æã
ããOprofileéè¦popt, bfd, libertyåºï¼è¦å¨åµå ¥å¼åæ¿ä¸ä½¿ç¨è¿äºåºï¼éè¦æå·¥å®æ交åç¼è¯ã
ããé对popt 1.7ï¼ç¨ä»¥ä¸å½ä»¤å®æç¼è¯ï¼
ãã./configure --prefix=/home/wave/xilinx/oprofileprj/rootfs --host=arm-xilinx-linux-gnueabi --with-kernel-support --disable-nls && make && make install
ããé对binutils 2.ï¼ç¨ä»¥ä¸å½ä»¤å®æç¼è¯ï¼
ãã./configure --host=arm-xilinx-linux-gnueabi --prefix=/home/wave/xilinx/oprofileprj/rootfs --enable-install-libbfd --enable-install-libiberty --enable-shared && make && make install
ããä¸è¿--enable-install-libiberty没æææï¼æ以éè¦æå·¥ælibiberty.aålibiberty.hæ·è´å°ç¸åºçä½ç½®ã
ããé对oprofile 0.9.9ï¼ç¨ä»¥ä¸å½ä»¤å®æç¼è¯ï¼
ãã./configure --host=arm-xilinx-linux-gnueabi --prefix=/home/wave/xilinx/oprofileprj/rootfs --with-kernel-support --with-binutils=/home/wave/xilinx/oprofileprj/rootfs && make && make install
ããé ç½®è¿ç¨ç»æåå¯è½ä¼æ以ä¸æ示ï¼å 为没ææç®ç¨GUIåprofile JITed codeï¼æ以ç´æ¥å¿½è§ä¹ã
ããconfig.status: executing libtool commands
ããWarning: QT version 3 was requested but not found. No GUI will be built.
ããWarning: The user account 'oprofile:oprofile' does not exist on the system.
ããTo profile JITed code, this special user account must exist.
ããPlease ask your system administrator to add the following user and group:
ããuser name : 'oprofile'
ããgroup name: 'oprofile'
ããThe 'oprofile' group must be the default group for the 'oprofile' user.
ããå°ç¼è¯å®æçuImageï¼vmlinuxï¼oprofile binaryï¼éæ°ç¼è¯ç没æ-pgçlibjpeg binary以åtool chainçlibcæå æ¾å°SDå¡ä¸ï¼åå¤å¨ZCå¼åæ¿ä¸å°è¯profile djpegã
ããä¸. è¿è¡Oprofile
ããæ£å¸¸å¯å¨åµå ¥å¼Linuxåï¼å¨å¼åæ¿çconsoleä¸ä¸æ¬¡è¾å ¥ä»¥ä¸å½ä»¤ï¼
ããmount /dev/mmcblk0p1 /mnt
ããmkdir -p /home/root/work
ããcd /home/root/work
ããtar zxvf /mnt/jpeg-bin-nopg.tar.gz
ããcd jpeg-bin/bin
ããcp /mnt/park-x.jpg .
ããexport LD_LIBRARY_PATH=/home/root/work/jpeg-bin/lib
ããcd /home/root/work
ããtar zxvf /mnt/rootfs.tar.gz
ããcd rootfs
ããchown root:root -R
*ããcp -R bin/* /usr/bin
ããcp -R lib/* /lib
ããcp /bin/which /usr/bin
ããcp /bin/dirname /usr/bin
ããmkdir -p /home/wave/xilinx/oprofileprj/rootfs/share
ããcp -R ./rootfs/* /home/wave/xilinx/oprofileprj/rootfs
ããcd /home/root/work
ããtar zxvf /mnt/libc.tar.gz
ããcp ./lib/libstdc*.* /lib
ããmkdir -p /home/wave/xilinx/libjpeg
ããcd /home/wave/xilinx/libjpeg
ããtar zxvf /mnt/jpeg-9.tar.gz
ããcp /mnt/vmlinux /home/root/work
ããcd /home/root/work/jpeg-bin/bin
ããopcontrol --init
ããopcontrol --vmlinux=/home/root/work/vmlinux
ããopcontrol --setup --event=CPU_CYCLES:::0:1 --session-dir=/home/root/
ããoperf --vmlinux /home/root/work/vmlinux ./djpeg -bmp park-x.jpg > result.bmp
ããopreport -l ./djpeg
ããå®æè¿ä¸æ¥åï¼æ们就å¯ä»¥çå°profilingçç»æäºï¼å¨ç¬è çå¹³å°ä¸çå°çå 容ç主è¦é¨åå¦ä¸ï¼
ããroot@zynq:~/work/jpeg-bin/bin# opreport -l ./djpeg
ããUsing /home/root/work/jpeg-bin/bin/oprofile_data/samples/ for samples directory.
ããCPU: ARM Cortex-A9, speed MHz (estimated)
ããCounted CPU_CYCLES events (CPU cycle) with a unit mask of 0x (No unit mask) count
ããsamples % image name symbol name
ãã . libc-2..so /lib/libc-2..so
ãã 7. libjpeg.so.9.0.0 ycc_rgb_convert
ãã 7. libjpeg.so.9.0.0 jpeg_idct_x
ãã 7. libjpeg.so.9.0.0 decode_mcu
ãã 6. libjpeg.so.9.0.0 jpeg_idct_islow
ãã 6. djpeg finish_output_bmp
ãã 2. libjpeg.so.9.0.0 jpeg_fill_bit_buffer
ãã 1. djpeg put_pixel_rows
ãã 0. vmlinux __copy_from_user
ãã 0. libjpeg.so.9.0.0 decompress_onepass
ãã 0. libjpeg.so.9.0.0 jpeg_huff_decode
ãã 0. vmlinux get_page_from_freelist
ãã 0. vmlinux __memzero
ãã 0. vmlinux __copy_to_user_std
ãã 0. vmlinux _raw_spin_unlock_irqrestore
ãã 0. vmlinux do_page_fault
ãã 0. vmlinux __generic_file_aio_write
ãã 0. vmlinux _raw_spin_unlock_irq
ãã 0. vmlinux free_hot_cold_page
ãã 0. vmlinux vector_swi
ãã 0. vmlinux handle_pte_fault
ããä»ç»æä¸æ们å¯ä»¥çå°libjpeg.so.9.0.0, djpegåvmlinuxä¸çsymbol nameå·²ç»å¯ä»¥è¢«æ£ç¡®ç解æåºæ¥äºï¼ågprofçç»æåºæ¬ä¸è´ãç¸æ¯gprofï¼oprofileå¯ä»¥å¨æ´å¤§çèå´å å®æprofilingã
ããæ们è¿å¯ä»¥ç¨ä»¥ä¸å½ä»¤è§å¯æºä»£ç ä¸ç¹å®è¡çæ§è¡æ¶é´ï¼è¿ä¸æ¥ç¼©å°ä¼åçèå´ï¼è¾¾å°äºåååçææã
ããopannotate --source ./djpeg > opannotate.txt
ããå. å°ç»
ããéè¿å®éªï¼æ们å¯ä»¥çå°Oprofileå¯ä»¥æä¾æ´ä¸°å¯çprofilingç»æï¼å¯ä»¥æ´å¥½ç帮å©å¼åè æ¾å°ç¶é¢ï¼éè¿æé对æ§çä¼åæå软件 æ§è½;profilingçç»æä¹å¯ä»¥å¸®å©å¼åè å°æ§è½ç¶é¢ä»£ç éè¿Xilinx HLSå·¥å ·ç¨ç¡¬ä»¶å éå¨æ¥å®ç°ï¼ä»è为è¿ä¸æ¥æåæ´ä¸ªåµå ¥å¼ç³»ç»çæ§è½æå¼äºå¤§é¨ã
2024-12-28 20:48
2024-12-28 20:43
2024-12-28 18:59
2024-12-28 18:46
2024-12-28 18:43
2024-12-28 18:29