From patchwork Wed Jan 17 09:43:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karl Vogel X-Patchwork-Id: 862130 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GJnCmGkB"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="h/uWNj2I"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zM2Gs07GMz9ryT for ; Wed, 17 Jan 2018 20:44:05 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-ID:Date: In-reply-to:To:From:References:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bUXXfterMeCVcVrLi750TUv23kOAVYXXsWjWIu9Y3rM=; b=GJnCmGkBDdj3Uq M1fFb4GHsGJ3ImVIoFOmrHDLJewTSYWKrBBAPhBMniI4iZbmvsa5d8TdsEbfTDvytRcJg6PPL7l8V 7TxSRkpZbHGJ89Ctvf92lNwMbVEdJmZ/VpkgSuzQ7EKqMZ7A82qDIpXlAc4p0lKSdekQUJHf/3J67 yZwIYsBCGlVyGa1p0Il56u0lPBxdR7Ye1v5alECBLYLknpkBwSG+b+u9mHDNMKxf9wtCJxft1XUlL inpf2cT1+e0LTKPVzoJl6CoKCL0byhU6C4Gb7CRPTrGZDWBpC5nAC7Tc/TFxN9ouvOwitgQiLj5or sZOSgXT4V8WyH/tR1WTA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ebkGH-0000rs-MV; Wed, 17 Jan 2018 09:44:01 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ebkGD-0000qC-4z for lede-dev@lists.infradead.org; Wed, 17 Jan 2018 09:43:59 +0000 Received: by mail-wm0-x243.google.com with SMTP id f3so14348799wmc.1 for ; Wed, 17 Jan 2018 01:43:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=fmMdjAIKXjs+ximnHmmOs14pavqO6jA/51sunT+idWg=; b=h/uWNj2IatStOLhc3RpIlrHLdy6rd5hrpYnrvOMMrabwTFr6enHeJO2kLz11aXNwFg p9ObcZZrWHT0sEDsO9N8YA3D8hIitiiS++Qh17gJcD6VsbTpKxazDIxy2VE8a41z3dR4 o9meofEmG+263ZWWEpSAcfuaPS6mmWnIZWcVH3jDuqDdsQCU0R06wujbpHLVu35aDpLA Lpn6m/bxmCFUjlJUBmVj3ZAUKL/zCQS+Kg5aRJ8htVMiiWXHdqElIMpE8k3LdBD3WmkN SsK/6ZipNkyAwfYh4+9IME09tM941H01wZ8puxVzXsGB19H3RkfP8RgB8ZF+AaTHWma3 KqtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=fmMdjAIKXjs+ximnHmmOs14pavqO6jA/51sunT+idWg=; b=bY0wc+GfmR5Ux0SVfFe5UGvoIQVGOKAGRd9U04KBW+vVwi8QwoIklynHSixVoEmhFS nkeV+mzXmFfuYIgxWG0TBBsUB5rdcxuY6UicCCEunipazDf3zlGN/tMwAPmrKhfuzt47 1Savl4NWgLwKmBXBIAX3YQRtjeinNIgoDKo2LVYQm6HF1P+FS1UwsTpbZn6MPPBjTxe7 YjXNvE2tkaxBRyfo4xclUV+TCI8aIizA5PP4AUtDSIgLUT/oo/dBk8Bz4Tzpz769w8bC 3r99mjYFNq9tl0dXFXxkqWMhpxUhd9Y84ipepP0xTZ7YSAQKu70ROalG/HG0LCg1WL53 XedA== X-Gm-Message-State: AKwxytdjoURO4a1qtdIniIQXtaYBBTR+pBbfs1NlsKreYsNDYd8iZM5B +njqs+kKFW4gUzRkjnkEJlyI0TzKN6E= X-Google-Smtp-Source: ACJfBouBgOmSOjSkk50iDqXXn2ittg2MuZQT0/WRsOdA+KQc199gTdKVv5vkGmynEs4dBpb5vS3nuA== X-Received: by 10.80.132.170 with SMTP id 39mr1964049edq.231.1516182222025; Wed, 17 Jan 2018 01:43:42 -0800 (PST) Received: from cplx1026.gmail.com (14.125.146.82.ipv4.evonet.be. [82.146.125.14]) by smtp.gmail.com with ESMTPSA id a16sm3097385edd.19.2018.01.17.01.43.41 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 17 Jan 2018 01:43:41 -0800 (PST) References: User-agent: mu4e 0.9.18; emacs 26.0.50.2 From: Karl Vogel To: John Crispin In-reply-to: Date: Wed, 17 Jan 2018 10:43:40 +0100 Message-ID: MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c09:0:0:0:243 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (karl.vogel[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [LEDE-DEV] [PATCH v2] procd: add timing to start/stop logging X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lede-dev@lists.infradead.org Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Shows how long an initd task took, for example: procd: stop /etc/init.d/dropbear running - took 0.088824s procd: Update service dnsmasq procd: Update instance dnsmasq::dnsmasq procd: running /etc/init.d/dnsmasq running procd: start /etc/init.d/dnsmasq running procd: stop /etc/init.d/dnsmasq running - took 0.092586s Signed-off-by: Karl Vogel --- rcS.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rcS.c b/rcS.c index dd3b76d..acfb6a0 100644 --- a/rcS.c +++ b/rcS.c @@ -37,6 +37,7 @@ static struct runqueue q, r; struct initd { struct ustream_fd fd; struct runqueue_process proc; + struct timeval tv_start; char *file; char *param; }; @@ -70,6 +71,7 @@ static void q_initd_run(struct runqueue *q, struct runqueue_task *t) int pipefd[2]; pid_t pid; + gettimeofday(&s->tv_start, NULL); DEBUG(2, "start %s %s \n", s->file, s->param); if (pipe(pipefd) == -1) { ERROR("Failed to create pipe: %m\n"); @@ -106,8 +108,11 @@ static void q_initd_run(struct runqueue *q, struct runqueue_task *t) static void q_initd_complete(struct runqueue *q, struct runqueue_task *p) { struct initd *s = container_of(p, struct initd, proc.task); + struct timeval tv_stop, tv_res; - DEBUG(2, "stop %s %s \n", s->file, s->param); + gettimeofday(&tv_stop, NULL); + timersub(&tv_stop, &s->tv_start, &tv_res); + DEBUG(2, "stop %s %s - took %lu.%06lus\n", s->file, s->param, tv_res.tv_sec, tv_res.tv_usec); ustream_free(&s->fd.stream); close(s->fd.fd.fd); free(s);