"Fossies" - the Fresh Open Source Software Archive

Member "sysdig-0.26.1/userspace/sysdig/chisels/topscalls_time.lua" (24 May 2019, 1716 Bytes) of package /linux/misc/sysdig-0.26.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lua source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 --[[
    2 Copyright (C) 2013-2018 Draios Inc dba Sysdig.
    3 
    4 This file is part of sysdig.
    5 
    6 Licensed under the Apache License, Version 2.0 (the "License");
    7 you may not use this file except in compliance with the License.
    8 You may obtain a copy of the License at
    9 
   10     http://www.apache.org/licenses/LICENSE-2.0
   11 
   12 Unless required by applicable law or agreed to in writing, software
   13 distributed under the License is distributed on an "AS IS" BASIS,
   14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   15 See the License for the specific language governing permissions and
   16 limitations under the License.
   17 
   18 --]]
   19 
   20 -- The number of items to show
   21 TOP_NUMBER = 30
   22 
   23 -- Chisel description
   24 description = "Show the top " .. TOP_NUMBER .. " system calls in terms of time spent in each call. You can use filters to restrict this to a specific process, thread or file. This chisel is compatible with containers using the sysdig -pc or -pcontainer argument, otherwise no container information will be shown."
   25 short_description = "Top system calls by time"
   26 category = "Performance"
   27 
   28 -- Chisel argument list
   29 args = {}
   30 
   31 -- Argument notification callback
   32 function on_set_arg(name, val)
   33     return false
   34 end
   35 
   36 -- Initialization callback
   37 function on_init()
   38     -- The -pc or -pcontainer options was supplied on the cmd line
   39     print_container = sysdig.is_print_container_data()
   40 
   41     if print_container then
   42         chisel.exec("table_generator", 
   43             "evt.type,container.name",
   44             "Syscall,container.name",
   45             "evt.latency",
   46             "Time",
   47             "", 
   48             "" .. TOP_NUMBER,
   49             "time")
   50     else
   51         chisel.exec("table_generator", 
   52             "evt.type",
   53             "Syscall",
   54             "evt.latency",
   55             "Time",
   56             "", 
   57             "" .. TOP_NUMBER,
   58             "time")
   59     end
   60 
   61     return true
   62 end