From patchwork Fri Aug 6 21:35:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 12423931 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11057C4320A for ; Fri, 6 Aug 2021 21:36:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E56E761186 for ; Fri, 6 Aug 2021 21:36:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245257AbhHFVgS (ORCPT ); Fri, 6 Aug 2021 17:36:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245261AbhHFVgR (ORCPT ); Fri, 6 Aug 2021 17:36:17 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2793C061798 for ; Fri, 6 Aug 2021 14:36:00 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d17so8792663plr.12 for ; Fri, 06 Aug 2021 14:36:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=lRJUx9M9PkpSlRyma5IgNqqGSYHjUDuHJLU3o9RBpa4=; b=fmKyw6z0e+MMPb7FaqHpb0eDWT++XynhUxXySWmjgjDD3E9AZSzpUYfuuqXSMd0kGp 3awyWG9s4ye+JfSElinreK0gZMe8kDseElKFng3wx8mYdAiJTzf6zrQZvB32iPVDiqnt nhYb8GGHUxoISeT7D3btM60LFPJGMCMBXXBuTdrsvL/efEF5iq/0HFRESQHJe9RaFmsp vBwg9gJLKkaiTR+AwEMxN7+wM3M006XrVpvpe1htHtTmEKiKsuVfqeC2oFAfyXC8N6K2 u6+CTV5OWXCS4utjOVGs4RgrkkQqWpJVm3koBqxWgfPbVo1z9qwI4CgS5MhZmOH99GNy XGuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=lRJUx9M9PkpSlRyma5IgNqqGSYHjUDuHJLU3o9RBpa4=; b=WiFvrusO5LYWn7vNLp77ux+vr3MRdxp1qBAoIHQyqXfyrr18oaxZa/LQLAQLCRRn1b 5UZ7KrJLNYgEgS3dgyf7QNtUfWU6T+H0hE+A5SlZ5nCCJgR7mLh7/aFgwe6BzoudggLz FqLlwiBWR1aC8czE1G3mJSWeOWaLduEFEKStlO9LsbpZpyrBlmAVncVE4OZ3+n9whDcT 49PatHbIK1fRrE/3SNofoi62jsOIkGbxtoD2mriZjbTsSbnRrxYl0Mxc/ASL5zOpKhqj mwXryNJYyPh4KjPizzKDc3SXEP+zidyEfiv08ojO2t5iawkdM0wIWAV6JBlfXlPfrBx9 uYaA== X-Gm-Message-State: AOAM5339smFjXgERiDv8uYQdIuCPLRvi7ezumLAYiIobfDdztExh8OuS 2rRXyujJiolX0SryHljoGKeZmZrc9+A= X-Google-Smtp-Source: ABdhPJzUCv3FQMyxn+OkAjOWX1Asjfenr0g6qbbSzH7/C/4ZHqdgCZH17QgqnGmr7Ivz43/U5n3RQg== X-Received: by 2002:a17:90a:6684:: with SMTP id m4mr567002pjj.127.1628285760042; Fri, 06 Aug 2021 14:36:00 -0700 (PDT) Received: from lvondent-mobl4.intel.com (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id h20sm11765201pfn.173.2021.08.06.14.35.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Aug 2021 14:35:58 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 1/4] monitor: Fix median packet size Date: Fri, 6 Aug 2021 14:35:55 -0700 Message-Id: <20210806213558.16442-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz Calculating the median packet based on the current median + size / 2 does not account for last packet could smaller e.g. opp transfer could end with just 1 byte which would cut the median in a half, so this switch to more traditional means of calculating by doing total bytes sent / num of packets so each an every packet has the same weight. --- monitor/analyze.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/monitor/analyze.c b/monitor/analyze.c index 839c2f7e9..5e0957ad1 100644 --- a/monitor/analyze.c +++ b/monitor/analyze.c @@ -61,6 +61,7 @@ struct hci_conn { unsigned long rx_num; unsigned long tx_num; unsigned long tx_num_comp; + size_t tx_bytes; struct timeval last_tx; struct timeval last_tx_comp; struct timeval tx_lat_min; @@ -99,6 +100,8 @@ static void conn_destroy(void *data) break; } + conn->tx_pkt_med = conn->tx_bytes / conn->tx_num; + printf(" Found %s connection with handle %u\n", str, conn->handle); printf(" BD_ADDR %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", conn->bdaddr[5], conn->bdaddr[4], conn->bdaddr[3], @@ -485,16 +488,12 @@ static void acl_pkt(struct timeval *tv, uint16_t index, bool out, if (out) { conn->tx_num++; conn->last_tx = *tv; + conn->tx_bytes += size; if (!conn->tx_pkt_min || size < conn->tx_pkt_min) conn->tx_pkt_min = size; if (!conn->tx_pkt_max || size > conn->tx_pkt_max) conn->tx_pkt_max = size; - if (conn->tx_pkt_med) { - conn->tx_pkt_med += (size + 1); - conn->tx_pkt_med /= 2; - } else - conn->tx_pkt_med = size; } else { conn->rx_num++; } From patchwork Fri Aug 6 21:35:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 12423929 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFC60C4338F for ; Fri, 6 Aug 2021 21:36:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8517061186 for ; Fri, 6 Aug 2021 21:36:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245262AbhHFVgS (ORCPT ); Fri, 6 Aug 2021 17:36:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245255AbhHFVgR (ORCPT ); Fri, 6 Aug 2021 17:36:17 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F568C0613CF for ; Fri, 6 Aug 2021 14:36:01 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id t3so8805372plg.9 for ; Fri, 06 Aug 2021 14:36:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=P3IDmVuKO7O3HkuAlMjxQDVH5awewBmJogAj+DT7iIw=; b=n4DVEB5DM+jTjoLxjxzatuaGuEw/LBB7DNQSbGX0hJVhKo6+Fw/0zMG3RbXq1BYY/g OQYGBH/I5nrqtYU2Jfw4X7F0dhwXUb4vnO+1yl0bT0xAg7/00drMAVrunX1KB3wOgMzP Vi91RWspgbygSyekn6beYtBYL3bsfn/iIerD3RaBEyzIv/0/XqhLJD69C39/b+Cd1DYX BmkmA3fpPaRI4MAWjfRfIQxUVNz3Y+WiiMIohI5uUTgaY5pZaqYqKeziKjnxpb7RVifM HqjbvzudV22tNAEiPrtHkDr/wjxxO2OAxXmNRDa6qNAntl6v8o9Xz/V7TwKNZJs1XVUA +iJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P3IDmVuKO7O3HkuAlMjxQDVH5awewBmJogAj+DT7iIw=; b=mpj8NOQUWujpQbtdyGegrujsQl4tedDhsTe3Wpy1WTQp75cz+4LfLc330PzED6XS7B iSeJUlbBrwI8nS41D9q0+l3jbKUBeDWE2fH0Q4pqrFuvEgWpsu3WSCqkiqJo/W5LQPhB RmJyow8NBATsS5FuqIvehdAUDxYnD53ukoHOTgMdDOoPwNNCG4lqhG4YxEsOs0Att1fC +ZLYhIqZAzT0VvxJGoFZshMsnHre0tqZFdOH+p9zUzNf5a3qU0asuwzeNkd+IJj0tSnD jN/nrXsmGhnIUewXkr4tPGwC2v32KwAShxgjO6vyKuDRznkrR5dzPi9bqFEuTtt46iTT wqaA== X-Gm-Message-State: AOAM532EkmCaKOuqbhUEwGETcGg8h5PBx4GWOEi0PNZ3a9o4qwM6f/Ya 1pMmedTVON89o9JKXRlZdRCxlCuPNRw= X-Google-Smtp-Source: ABdhPJxyJnYnY/u4MzpzvgMWIjq4IQFjEsd82NgqqmtgEuIbrIXE5tL8eaBpvQkJWJC/ekdIYwo40w== X-Received: by 2002:a05:6a00:150d:b029:3c8:e86e:79ec with SMTP id q13-20020a056a00150db02903c8e86e79ecmr2161359pfu.62.1628285760688; Fri, 06 Aug 2021 14:36:00 -0700 (PDT) Received: from lvondent-mobl4.intel.com (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id h20sm11765201pfn.173.2021.08.06.14.36.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Aug 2021 14:36:00 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 2/4] monitor: Fix minimun packet latency Date: Fri, 6 Aug 2021 14:35:56 -0700 Message-Id: <20210806213558.16442-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210806213558.16442-1-luiz.dentz@gmail.com> References: <20210806213558.16442-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz It seems timer_sub can produce negative values leading to median packet latency to be negative e.g conn->last_tx_compl is ahead of conn->last_tx, in which case it should be discarded. --- monitor/analyze.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/monitor/analyze.c b/monitor/analyze.c index 5e0957ad1..d504c8d84 100644 --- a/monitor/analyze.c +++ b/monitor/analyze.c @@ -386,8 +386,9 @@ static void evt_num_completed_packets(struct hci_dev *dev, struct timeval *tv, if (timerisset(&conn->last_tx)) { timersub(&conn->last_tx_comp, &conn->last_tx, &res); - if (!timerisset(&conn->tx_lat_min) || - timercmp(&res, &conn->tx_lat_min, <)) + if ((!timerisset(&conn->tx_lat_min) || + timercmp(&res, &conn->tx_lat_min, <)) && + res.tv_sec >= 0 && res.tv_usec >= 0) conn->tx_lat_min = res; if (!timerisset(&conn->tx_lat_max) || @@ -408,6 +409,8 @@ static void evt_num_completed_packets(struct hci_dev *dev, struct timeval *tv, tmp.tv_usec -= 1000000; } } + + conn->tx_lat_med = tmp; } else conn->tx_lat_med = res; From patchwork Fri Aug 6 21:35:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 12423933 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5960EC432BE for ; Fri, 6 Aug 2021 21:36:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4249061186 for ; Fri, 6 Aug 2021 21:36:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245266AbhHFVgS (ORCPT ); Fri, 6 Aug 2021 17:36:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245263AbhHFVgS (ORCPT ); Fri, 6 Aug 2021 17:36:18 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 003F4C0613CF for ; Fri, 6 Aug 2021 14:36:01 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id u16so8850104ple.2 for ; Fri, 06 Aug 2021 14:36:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=gdVERoANZ0tlHyrIe2eSl8nR3RSsn9oSS1Ntfv4qMVw=; b=so1EHZgEx0oSyQgH+cot1Yt2+IBCcAz6z5m2lZ0zSDqToDzrNBjAipX2OS9IFPCvAY bPCpKD0siETzvBdeTJCSMDhM4igPnkufWjXaRqEqy+jzeI4NBSBGfXuNr3hExU1vBkQ1 WKJY65zHbA0gXhbYMJpgwWp01g64N8kVEqu7NWaQyfCLHfsKTnoodTF0i+QscXOXzk13 9+gpbmq2vx25T545kvgOwKt6XLHrgYdrkcVP7FHlI/flykvzna4911qjkDgZG5ohUDAR qKkWsWkkoOdpSUqWI8knqu7rYsuFNztCMh/c1IHm4WANMVlsUHzWelAh9iv6dS/MPwd8 H6Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gdVERoANZ0tlHyrIe2eSl8nR3RSsn9oSS1Ntfv4qMVw=; b=dyri1L3jP7jzED38nhi+5K/yF2kuexxJcQ6EEpCNVUc7pmNau0TZCnns30f+aug2D2 tjddOQ55xBhaRQQhsy5oMXnWGwr7kKHV+TlmNgE0ebj5YPFM0kVMl1kL4V/18aASc3qS e5uK5GM3gpB82SFUR9dhzS4gzA7dFOxfXPs6ka7TUKqjopYTHbTf4wKBYUQ6QIYDbpQ0 F8Sg+WKuhSF1ybsKLGK9Ciywbe1PLqo0dcIcRN/2a6+Px0FBkhmuZ96Depdyat9Sw3z0 XFMQLg/PlqSSLihwuGIyk90w/22B2uy0xrC3tRFoc/aMsnVTj3C0NDIt4gmgY7VPAO8e pWHQ== X-Gm-Message-State: AOAM531hESelFJ2KRdm+iorPsiO751ObqfAOV0a7aymz3VTcgCScAZgr 4jAR88vdZGAbX/O9bT8sPqLreGZLZjo= X-Google-Smtp-Source: ABdhPJx5szF57bJCDJYRlJ+hL9KjnsdNi6a97QmHHccpXga3Ih8rjwYAcyJU/P19DKHE1yuSoGTEuQ== X-Received: by 2002:a17:90a:e2c8:: with SMTP id fr8mr11921745pjb.131.1628285761361; Fri, 06 Aug 2021 14:36:01 -0700 (PDT) Received: from lvondent-mobl4.intel.com (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id h20sm11765201pfn.173.2021.08.06.14.36.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Aug 2021 14:36:01 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 3/4] monitor: Fix not accouting for multiple outstanding packets Date: Fri, 6 Aug 2021 14:35:57 -0700 Message-Id: <20210806213558.16442-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210806213558.16442-1-luiz.dentz@gmail.com> References: <20210806213558.16442-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz Analyze code was not accounting for the fact that multiple outstanding packets could be pending which will cause the last_tx to be overwritten but its latency would be calculated against the very first packet complete. --- monitor/analyze.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/monitor/analyze.c b/monitor/analyze.c index d504c8d84..aae153f94 100644 --- a/monitor/analyze.c +++ b/monitor/analyze.c @@ -62,8 +62,7 @@ struct hci_conn { unsigned long tx_num; unsigned long tx_num_comp; size_t tx_bytes; - struct timeval last_tx; - struct timeval last_tx_comp; + struct queue *tx_queue; struct timeval tx_lat_min; struct timeval tx_lat_max; struct timeval tx_lat_med; @@ -121,6 +120,7 @@ static void conn_destroy(void *data) printf(" %u octets TX max packet size\n", conn->tx_pkt_max); printf(" %u octets TX median packet size\n", conn->tx_pkt_med); + queue_destroy(conn->tx_queue, free); free(conn); } @@ -133,6 +133,7 @@ static struct hci_conn *conn_alloc(struct hci_dev *dev, uint16_t handle, conn->handle = handle; conn->type = type; + conn->tx_queue = queue_new(); return conn; } @@ -372,6 +373,7 @@ static void evt_num_completed_packets(struct hci_dev *dev, struct timeval *tv, uint16_t count = get_le16(data + 2); struct hci_conn *conn; struct timeval res; + struct timeval *last_tx; data += 4; size -= 4; @@ -381,10 +383,10 @@ static void evt_num_completed_packets(struct hci_dev *dev, struct timeval *tv, continue; conn->tx_num_comp += count; - conn->last_tx_comp = *tv; - if (timerisset(&conn->last_tx)) { - timersub(&conn->last_tx_comp, &conn->last_tx, &res); + last_tx = queue_pop_head(conn->tx_queue); + if (last_tx) { + timersub(tv, last_tx, &res); if ((!timerisset(&conn->tx_lat_min) || timercmp(&res, &conn->tx_lat_min, <)) && @@ -414,7 +416,7 @@ static void evt_num_completed_packets(struct hci_dev *dev, struct timeval *tv, } else conn->tx_lat_med = res; - timerclear(&conn->last_tx); + free(last_tx); } } } @@ -489,8 +491,12 @@ static void acl_pkt(struct timeval *tv, uint16_t index, bool out, return; if (out) { + struct timeval *last_tx; + conn->tx_num++; - conn->last_tx = *tv; + last_tx = new0(struct timeval, 1); + memcpy(last_tx, tv, sizeof(*tv)); + queue_push_tail(conn->tx_queue, last_tx); conn->tx_bytes += size; if (!conn->tx_pkt_min || size < conn->tx_pkt_min) From patchwork Fri Aug 6 21:35:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 12423935 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC2B5C4338F for ; Fri, 6 Aug 2021 21:36:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D50F161186 for ; Fri, 6 Aug 2021 21:36:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245268AbhHFVgU (ORCPT ); Fri, 6 Aug 2021 17:36:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245260AbhHFVgT (ORCPT ); Fri, 6 Aug 2021 17:36:19 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB0C6C0613CF for ; Fri, 6 Aug 2021 14:36:02 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id l19so18734251pjz.0 for ; Fri, 06 Aug 2021 14:36:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=h5O23deTS/YJXaWeLzUnVmuu6XP6/UdUDz9XhtpcMXY=; b=vbVwbu3DiogbUhIsTn7kE4HHTObVoO8snQDIEEVKMg6AGJLu2xEQ65dvd8tkGSiU3Q 7IGZ9Y9hrSEvd4LwHnumHQVo+mBt3Fjakoso4/ydFEFzqaVmMAfRi2fRxl06iu+AhvOG yAs96qi279zM5xBrgnhhfztO7zJ/Gc6+MowGKzpVuc5Wm0cu1x33y6OnGtUKod52Oo70 CyyZAaXYUQCHJVHRODe5I3RoxZDp+7pxGgEopx+qbZrPUlRkLknutE0ZL5M4GsKOEvvo Y3LUfno4jgbLzCTKinVBfEGHWieM8G35w+vvBDCQpgGR8ckGX1TizRViqkNiGhFL0dF+ J9+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=h5O23deTS/YJXaWeLzUnVmuu6XP6/UdUDz9XhtpcMXY=; b=fkghsY4aEyaamy//fwe7rsT38bKLw10/JOlT9BTRTAtXZe68Zq2+ppdYQmktwOAYuH h5AOH7uaYN0TrxRJx2igOUVLJXAGihdWeUd1e2HbAP7DX2277+E4V2QiKj8a1YUBptfy fMoDHCmoly2Rw7r73j28AiSLT7Wg4m7mjosE2eQvJwRUXQdUOoNPO6BY9yW7u7rmRDuL CrJj0D4CjbC/o9/hZw1VzrFeB31Y9xMMh6azFu2cNdSXl+YmkG9V87pwsL2q5cJvm0ye f3FXTCLK/dtDVmGuCVEpMy4CbM8E7zfLarjsioy3BNns4pb2ydwUk567JLxb8OBeGCbB YFIg== X-Gm-Message-State: AOAM530yt8DbzjCprOLWTDJKhJytvpvVTybKbiRuX8rfoZhrYwaC6vcw ZUGf296M9C5DIPE0GANdqqvygDUt9OQ= X-Google-Smtp-Source: ABdhPJzjRkVFtXHG+gGp6rk92GNxIoNHTXl/DlHxCQEfKnv8iQu78bnWuaF6em/SGIucLAejJf5RYQ== X-Received: by 2002:a17:90b:4a90:: with SMTP id lp16mr12213930pjb.74.1628285762176; Fri, 06 Aug 2021 14:36:02 -0700 (PDT) Received: from lvondent-mobl4.intel.com (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id h20sm11765201pfn.173.2021.08.06.14.36.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Aug 2021 14:36:01 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 4/4] monitor: Make --analyze output latencies in msec Date: Fri, 6 Aug 2021 14:35:58 -0700 Message-Id: <20210806213558.16442-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210806213558.16442-1-luiz.dentz@gmail.com> References: <20210806213558.16442-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz Milisecconds is probably the best unit to have since it is unlikely that the controller can respond in under 1 msec as well as most time sensitive connection e.g. A2DP, HFP, etc, also don't expect the latencies to be over 1 sec. --- monitor/analyze.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/monitor/analyze.c b/monitor/analyze.c index aae153f94..bee05f467 100644 --- a/monitor/analyze.c +++ b/monitor/analyze.c @@ -110,12 +110,15 @@ static void conn_destroy(void *data) printf(" %lu RX packets\n", conn->rx_num); printf(" %lu TX packets\n", conn->tx_num); printf(" %lu TX completed packets\n", conn->tx_num_comp); - printf(" %ld.%06ld seconds min latency\n", - conn->tx_lat_min.tv_sec, conn->tx_lat_min.tv_usec); - printf(" %ld.%06ld seconds max latency\n", - conn->tx_lat_max.tv_sec, conn->tx_lat_max.tv_usec); - printf(" %ld.%06ld seconds median latency\n", - conn->tx_lat_med.tv_sec, conn->tx_lat_med.tv_usec); + printf(" %ld msec min latency\n", + conn->tx_lat_min.tv_sec * 1000 + + conn->tx_lat_min.tv_usec / 1000); + printf(" %ld msec max latency\n", + conn->tx_lat_max.tv_sec * 1000 + + conn->tx_lat_max.tv_usec / 1000); + printf(" %ld msec median latency\n", + conn->tx_lat_med.tv_sec * 1000 + + conn->tx_lat_med.tv_usec / 1000); printf(" %u octets TX min packet size\n", conn->tx_pkt_min); printf(" %u octets TX max packet size\n", conn->tx_pkt_max); printf(" %u octets TX median packet size\n", conn->tx_pkt_med);