Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
942 changes: 942 additions & 0 deletions ab_scsi.d

Large diffs are not rendered by default.

40 changes: 21 additions & 19 deletions arc_adjust.v2.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,34 @@
#pragma D option quiet

arc_adjust:entry
/* Adjusted slightly to work on smartOS. Had to replace global `arc_meta_used var with
value from kstat data: `arc_stats.arcstat_meta_used.value.ui64. */
{
self->ts = walltimestamp;
printf("%Y 1836: adjustment = MIN( %d, %d)\n", walltimestamp,
(int64_t)(`arc_stats.arcstat_size.value.ui64 - `arc_stats.arcstat_c.value.ui64),
(int64_t)(`arc_anon->arcs_size + `arc_mru->arcs_size + `arc_meta_used - `arc_stats.arcstat_p.value.ui64));
printf("arc_size = %d, arc_c = %d, arc_anon.size = %d, arc_mru.size = %d, arc_meta_used = %d, arc_p = %d\n",
`arc_stats.arcstat_size.value.ui64,
`arc_stats.arcstat_c.value.ui64,
`arc_anon->arcs_size,
`arc_mru->arcs_size,
`arc_meta_used,
`arc_stats.arcstat_p.value.ui64);
printf("arc_mfu.size = %d, arc_mfu_ghost.size = %d, arc_mru_ghost.size = %d, arc_l2c_only.size = %d\n",
`arc_mfu->arcs_size,
`arc_mfu_ghost->arcs_size,
`arc_mru_ghost->arcs_size,
`arc_l2c_only->arcs_size);
self->ts = walltimestamp;
printf("%Y 1836: adjustment = MIN( %d, %d)\n", walltimestamp,
(int64_t)(`arc_stats.arcstat_size.value.ui64 - `arc_stats.arcstat_c.value.ui64),
(int64_t)(`arc_anon->arcs_size + `arc_mru->arcs_size + `arc_stats.arcstat_meta_used.value.ui64 - `arc_stats.arcstat_p.value.ui64));
printf("arc_size = %d, arc_c = %d, arc_anon.size = %d, arc_mru.size = %d, arc_meta_used = %d, arc_p = %d\n",
`arc_stats.arcstat_size.value.ui64,
`arc_stats.arcstat_c.value.ui64,
`arc_anon->arcs_size,
`arc_mru->arcs_size,
`arc_stats.arcstat_meta_used.value.ui64,,
`arc_stats.arcstat_p.value.ui64);
printf("arc_mfu.size = %d, arc_mfu_ghost.size = %d, arc_mru_ghost.size = %d, arc_l2c_only.size = %d\n",
`arc_mfu->arcs_size,
`arc_mfu_ghost->arcs_size,
`arc_mru_ghost->arcs_size,
`arc_l2c_only->arcs_size);
}

arc_shrink:entry
{
printf("%Y 2085: to_free = MAX( %d, %d)\n", walltimestamp,
`arc_stats.arcstat_c.value.ui64 >> `arc_shrink_shift, `needfree*4096);
printf("%Y 2085: to_free = MAX( %d, %d)\n", walltimestamp,
`arc_stats.arcstat_c.value.ui64 >> `arc_shrink_shift, `needfree*4096);
}

arc_adjust:return
{
printf("Returned from arc_adjust started at %Y %d ms later.\n", self->ts, (walltimestamp - self->ts)/1000000);
printf("Returned from arc_adjust started at %Y %d ms later.\n", self->ts, (walltimestamp - self->ts)/1000000);
}
23 changes: 23 additions & 0 deletions arcaccess.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/sbin/dtrace -s

#pragma D option quiet

dtrace:::BEGIN
{
printf("lbolt rate is %d Hertz.\n", `hz);
printf("Tracing lbolts between ARC accesses...");
}

fbt::arc_access:entry
{
self->ab = args[0];
self->lbolt = args[0]->b_arc_access;
}

fbt::arc_access:return
/self->lbolt/
{
@ = quantize(self->ab->b_arc_access - self->lbolt);
self->ab = 0;
self->lbolt = 0;
}
21 changes: 21 additions & 0 deletions cifsops.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/sbin/dtrace -s

#pragma D option quiet

dtrace:::BEGIN
{
trace("Tracing CIFS operations... Interval 5 secs.\n");
}

smb:::op-*
{
@ops[args[0]->ci_remote, probename] = count();
}

profile:::tick-5sec,
dtrace:::END
{
printf("\n %-32s %-30s %8s\n", "Client", "Operation", "Count");
printa(" %-32s %-30s %@8d\n", @ops);
trunc(@ops);
}
16 changes: 16 additions & 0 deletions counter.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Count off and report the number of seconds elapsed
*/
dtrace:::BEGIN
{
i = 0;
}
profile:::tick-1sec
{
i = i + 1;
trace(i);
}
dtrace:::END
{
trace(i);
}
82 changes: 82 additions & 0 deletions diskioerr.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/usr/sbin/dtrace -s

#pragma D option quiet
#pragma D option dynvarsize=8m
#pragma D option switchrate=10hz
/*
Copyright 2012 Sam Zaydel - RackTop Systems

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

This script is intended to track IO where some buffer error was registered,
by looking for the B_ERROR flag in the bufinfo_t struct.
*/



dtrace:::BEGIN {
printf("Tracing... Hit Ctrl-C to end.\n");
}
io:::start {
start_time[arg0] = timestamp;
fire = 1;
}
io:::done / (args[0]->b_flags & B_READ) && (args[0]->b_flags & B_ERROR) && (this->start = start_time[arg0]) / {

@errors[args[1]->dev_pathname, "Error Code", args[0]->b_error] = count();
this->delta = (timestamp - this->start) / 1000;
/* @plots["Read I/O, us",
execname,
args[1]->dev_statname,
args[1]->dev_pathname,
args[1]->dev_major,
args[1]->dev_minor] = quantize(this->delta);
@avgs["Avg Read I/O, us"] = avg(this->delta);
@avgbytes["Avg Read bytes"] = avg(args[0]->b_bcount);
@perio_t["Avg Read bytes/us"] = avg(args[0]->b_bcount / this->delta);
*/
start_time[arg0] = 0;
error = 1;
}

io:::done / !(args[0]->b_flags & B_READ) && (args[0]->b_flags & B_ERROR) && (this->start = start_time[arg0]) / {

@errors[args[1]->dev_pathname, "Error Code",args[0]->b_error] = count();
this->delta = (timestamp - this->start) / 1000;
/* @plots["Write I/O, us",
execname,
args[1]->dev_statname,
args[1]->dev_pathname,
args[1]->dev_major,
args[1]->dev_minor] = quantize(this->delta);
@avgs["Avg Write I/O, us"] = avg(this->delta);
@avgbytes["Avg Write bytes"] = avg(args[0]->b_bcount);
@perio_t["Avg Write bytes/us"] = avg(args[0]->b_bcount / this->delta);
*/
start_time[arg0] = 0;
self->error = 1;

}

profile:::tick-5sec / error == 1 / {
printa("%s %s %d %@d\n", @errors); trunc(@errors);
/* printf("%Y\n", walltimestamp);
printa("%s %s %s :: %s\n (%d,%d), us:\n%@d\n", @plots);
printa("%18s %44@d\n", @avgs);
printa("%18s %44@d\n", @avgbytes);
printa("%18s %44@d\n", @perio_t);
printf("%s\n","");
trunc(@avgs); trunc(@avgbytes); trunc(@perio_t);
*/
error = 0;
}
27 changes: 27 additions & 0 deletions disklatency.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/sbin/dtrace -s

#pragma D option quiet

dtrace:::BEGIN
{
printf("Tracing... Hit Ctrl-C to end.\n");
}

io:::start
{
start_time[arg0] = timestamp;
}

io:::done
/this->start = start_time[arg0]/
{
this->delta = (timestamp - this->start) / 1000;
@[args[1]->dev_statname, args[1]->dev_major, args[1]->dev_minor] =
quantize(this->delta);
start_time[arg0] = 0;
}

dtrace:::END
{
printa(" %s (%d,%d), us:\n%@d\n", @);
}
38 changes: 38 additions & 0 deletions disklatency2.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/sbin/dtrace -s

#pragma D option quiet

dtrace:::BEGIN
{
printf("Tracing... Hit Ctrl-C to end.\n");
}

io:::start

{
start_time[arg0] = timestamp;
}

io:::done
/this->start = start_time[arg0]/
{
this->delta = (timestamp - this->start) / 1000;
@[execname, args[1]->dev_statname,
args[1]->dev_pathname,
args[1]->dev_major,
args[1]->dev_minor] = quantize(this->delta);
start_time[arg0] = 0;
}

profile:::tick-10sec

{
printa("%s %s :: %s\n (%d,%d), us:\n%@d\n ", @);
printf("%Y\n", walltimestamp);
}

/*dtrace:::END
{
printa("%s %s :: %s\n (%d,%d), us:\n%@d\n ", @);
}
*/
27 changes: 27 additions & 0 deletions disklatencygen.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/sbin/dtrace -s

#pragma D option quiet

dtrace:::BEGIN
{
printf("Tracing... Hit Ctrl-C to end.\n");
}

io:::start
{
start_time[arg0] = timestamp;
}

io:::done
/this->start = start_time[arg0]/
{
this->delta = (timestamp - this->start) / 1000;
@avgs[args[1]->dev_pathname,args[1]->dev_statname, args[1]->dev_major, args[1]->dev_minor] =
avg(this->delta);
start_time[arg0] = 0;
}

tick-1sec
{
printa("%s\t%s\t%d\t%d\t%@d\n", @avgs);
}
Loading