dtrace4linux / linux

dtrace for linux - kernel driver and userland tools
http://crtags.blogspot.com
1.17k stars 225 forks source link

dtrace: failed to initialize dtrace: DTrace device not available on system #119

Open CloudFeng opened 8 years ago

CloudFeng commented 8 years ago

today,I installed dtrace4linux. For my ubuntu system's information:

Ubuntu 14.04.2 LTS X86_64, 3.16.0-37-generic

I used it test the performance for Nginx like this^ref_1:

#!/usr/sbin/dtrace -s

    pid$1::ngx_http_handler:entry
    {
        elapsed = 0;
    }

    pid$1::ngx_http_core_access_phase:entry
    {
        begin = timestamp;
    }

    pid$1::ngx_http_core_access_phase:return
    /begin > 0/
    {
        elapsed += timestamp - begin;
        begin = 0;
    }

    pid$1::ngx_http_finalize_request:return
    /elapsed > 0/
    {
        @elapsed = avg(elapsed);
        elapsed = 0;
    }

When I run this script, it told:

dtrace: failed to initialize dtrace: DTrace device not available on system

I also run this cmd:dtrace -l,it also gave the same error.But I also written a simple script as followed^ref_2:

#!/usr/sbin/dtrace -s
BEGIN
{
    trace("hello");
    exit(0);
}

it worked well.I did not know what happened, so I used google to find the answer.However, nothing found out. Some people also faced it,like this one.

Thanks !

dtrace4linux commented 8 years ago

did you load the driver? ("make load")

On 13 December 2015 at 16:30, yunfeng notifications@github.com wrote:

today,I installed dtrace4linux For my ubuntu system's information:

Ubuntu 14042 LTS X86_64, 3160-37-generic

I used it test the performance for Nginx like this^ref_1 https://openrestyorg/download/agentzh-nginx-tutorials-zhcnhtml#02-NginxDirectiveExecOrder04 :

!/usr/sbin/dtrace -s

pid$1::ngx_http_handler:entry
{
    elapsed = 0;
}

pid$1::ngx_http_core_access_phase:entry
{
    begin = timestamp;
}

pid$1::ngx_http_core_access_phase:return
/begin > 0/
{
    elapsed += timestamp - begin;
    begin = 0;
}

pid$1::ngx_http_finalize_request:return
/elapsed > 0/
{
    @elapsed = avg(elapsed);
    elapsed = 0;
}

When I run this script, it told:

dtrace: failed to initialize dtrace: DTrace device not available on system

I also run this cmd:dtrace -l,it also gave the same errorBut I also written a simple script as followed^ref_2 http://dtraceorg/guide/chp-scripthtml:

!/usr/sbin/dtrace -s

BEGIN { trace("hello"); exit(0); }

it worked wellI did not know what happened, so I used google to find the answerHowever, nothing found out Some people also faced it,like this one http://askubuntucom/questions/648476/dtrace-failed-to-initialize-dtrace-dtrace-device-not-available-on-system-ubuntu

— Reply to this email directly or view it on GitHub https://github.com/dtrace4linux/linux/issues/119.

CloudFeng commented 8 years ago

I did all the steps which in this subsite.

cadedaniel commented 8 years ago

dtrace4linux is implemented as a dynamically loadable kernel module (i.e. it isn't loaded by default). Thus, I believe you need to run make load every time you restart your system.

https://en.wikipedia.org/wiki/Loadable_kernel_module

cpitclaudel commented 6 years ago

Hm. make load causes my kernel to panic.

yanghaichao12 commented 4 years ago

@cpitclaudel hi, how do you resolve this panic problem?