zoukankan      html  css  js  c++  java
  • ftrace 进程cmd 跟踪脚本

    #!/bin/bash
    
    DPATH="/sys/kernel/debug/tracing"
    
    ## shell pid
    PID=$$
    
    [ `id -u` -ne 0 ] && { echo "needs to be root" ; exit 1; } 
    
    [ -z $1 ] && { echo "needs process name as argument" ; exit 1; } 
    
    mount | grep -i debugfs &> /dev/null
    [ $? -ne 0 ] && { echo "debugfs not mounted, mount it first"; exit 1; } 
    
    
    # clear existing trace data
    echo nop > $DPATH/current_tracer
    
    # set function_graph tracer
    echo function_graph > $DPATH/current_tracer
    
    # write current process id to set_ftrace_pid file next will trace 
    echo $PID > $DPATH/set_ftrace_pid
    
    # start the tracing
    echo 1 > $DPATH/tracing_on
    
    # execute the process
    # $* all parameter list
    exec $*
    
    # stop the tracing
    echo 0 > tracing_on

     上述为ftrace 某一个process的基本脚本 
    ./trace-process.sh   ifconfig eth20  down   
    就可以看到 ifconfig eth20 down 时  内核运行函数 调用 

    from: https://www.codenong.com/cs106475776/

    http代理服务器(3-4-7层代理)-网络事件库公共组件、内核kernel驱动 摄像头驱动 tcpip网络协议栈、netfilter、bridge 好像看过!!!! 但行好事 莫问前程 --身高体重180的胖子
  • 相关阅读:
    头脑王者 艺术,电影,体育,时尚,动漫
    头脑王者 音乐
    头脑王者 地理
    头脑王者 历史,军事
    头脑王者 文学
    Jenkins project
    sql server drop login failed
    devenv.exe 编译Solution
    Jenkins
    头脑王者
  • 原文地址:https://www.cnblogs.com/codestack/p/14453293.html
Copyright © 2011-2022 走看看