procmem procrank--usr space内存分析工具

源码下载:

https://github.com/sunao2002002/mem_proc.git

  1. 解压后用下文内容替换CMakeLists.txt.

    SET(CMAKE_C_COMPILER "arm-buildroot-linux-uclibcgnueabihf-gcc")
    SET(CMAKE_CXX_COMPILER "arm-buildroot-linux-uclibcgnueabihf-g++")
    cmake_minimum_required(VERSION 2.8)
    PROJECT (mem_proc)
    file(GLOB SOURCES "${PROJECT_SOURCE_DIR}/libpagemap/*.c")
    add_definitions (
    -D_LARGEFILE64_SOURCE
    )
    include_directories (${PROJECT_SOURCE_DIR}/libpagemap/include)
    add_library(pagemap ${SOURCES})
    
    add_executable(procmem  ${PROJECT_SOURCE_DIR}/procmem/procmem.c)
    target_link_libraries(procmem pagemap)
    add_executable(procrank  ${PROJECT_SOURCE_DIR}/procrank/procrank.c)
    target_link_libraries(procrank pagemap)
    
  2. cd mem_proc

  3. mkdir out

  4. cd out

  5. cmake ..

  6. make 即可生成procmem和procrank

VSS:Virtual Set Size,虚拟内存耗用内存,包括共享库的内存

RSS:Resident Set Size,实际使用物理内存,包括共享库

PSS:Proportional Set Size,实际使用的物理内存,共享库按比例分配

USS:Unique Set Size,进程独占的物理内存,不计算共享库,也可以理解为将进程杀死能释