From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DC7ABA0579; Wed, 18 Mar 2020 20:06:33 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9E6651C19C; Wed, 18 Mar 2020 20:03:36 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 8C4051C0B0 for ; Wed, 18 Mar 2020 20:03:35 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02IJ1UgZ019414; Wed, 18 Mar 2020 12:03:35 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=atti3RBJ3Q0nhqTGFkCnQ5/JSTadilMduYIAUnmTKhs=; b=FqZr4TKVGK79iGboMUeVWMiOVhxnzWQkav4beqdDgYsJZnZ8gGBNI5QE0frx1c2SjRRU A72qDSBKI3OdPehbuzdcvQw5drPNOwRO1gF5v6eLWMPmwkx8GU2b7Oac7WXPBig2yV9X HM5yWYTio2yI3jU1BcTwxkSgkygXsQqYQ9iLkLGW9OBqQzmdHwZ/sYtlrUMzV0ipDqab nEM2gZaqy4KFg61byJzp9sArYWZoXLA7lG9Tk/20DFHdE+iZLQ94Y5LOkPtdIKjcJx8J LXA0p3ScAJi3BoXBss3tiUKj1sCNmnO9LkJ6uiDcfwjPF491Cuc1Nst+e80IjFJDh+fM AA== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2yu9rpbs2h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 18 Mar 2020 12:03:34 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 18 Mar 2020 12:03:32 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 18 Mar 2020 12:03:32 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 24F353F7040; Wed, 18 Mar 2020 12:03:29 -0700 (PDT) From: To: John McNamara , Marko Kovacevic , Jerin Jacob , "Sunil Kumar Kori" CC: , , , , Date: Thu, 19 Mar 2020 00:32:33 +0530 Message-ID: <20200318190241.3150971-25-jerinj@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200318190241.3150971-1-jerinj@marvell.com> References: <20200318190241.3150971-1-jerinj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.645 definitions=2020-03-18_07:2020-03-18, 2020-03-18 signatures=0 Subject: [dpdk-dev] [PATCH v1 24/32] eal/trace: add trace bufsize configuration parameter X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Sunil Kumar Kori Trace library exposes --trace-bufsz EAL parameter to configure maximum size of ring buffer where events are to be stored. Signed-off-by: Sunil Kumar Kori --- doc/guides/linux_gsg/eal_args.include.rst | 13 ++++++++ lib/librte_eal/common/eal_common_options.c | 17 +++++++++++ lib/librte_eal/common/eal_common_trace.c | 3 ++ .../common/eal_common_trace_utils.c | 30 +++++++++++++++++++ lib/librte_eal/common/eal_options.h | 2 ++ lib/librte_eal/common/eal_trace.h | 2 ++ 6 files changed, 67 insertions(+) diff --git a/doc/guides/linux_gsg/eal_args.include.rst b/doc/guides/linux_gsg/eal_args.include.rst index 8c72363b4..cc9fc0255 100644 --- a/doc/guides/linux_gsg/eal_args.include.rst +++ b/doc/guides/linux_gsg/eal_args.include.rst @@ -166,6 +166,19 @@ Debugging options By default, trace output will created at ``home`` directory and parameter must be specified once only. +* ``--trace-bufsz=`` + + Specify maximum size of allocated memory for trace output for each thread. + Valid unit can be either ``B`` or ``K`` or ``M`` for ``Bytes``, ``KBytes`` + and ``MBytes`` respectively. For example: + + Configuring ``2MB`` as a maximum size for trace output file:: + + --trace-bufsz=2M + + By default, size of trace output file is ``1MB`` and parameter + must be specified once only. + Other options ~~~~~~~~~~~~~ diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index d71f89be2..fb07206b0 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -70,6 +70,7 @@ eal_long_options[] = { {OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM }, {OPT_TRACE_LEVEL, 1, NULL, OPT_TRACE_LEVEL_NUM }, {OPT_TRACE_DIR, 1, NULL, OPT_TRACE_DIR_NUM }, + {OPT_TRACE_BUF_SIZE, 1, NULL, OPT_TRACE_BUF_SIZE_NUM }, {OPT_MASTER_LCORE, 1, NULL, OPT_MASTER_LCORE_NUM }, {OPT_MBUF_POOL_OPS_NAME, 1, NULL, OPT_MBUF_POOL_OPS_NAME_NUM}, {OPT_NO_HPET, 0, NULL, OPT_NO_HPET_NUM }, @@ -1440,6 +1441,15 @@ eal_parse_common_option(int opt, const char *optarg, break; } + case OPT_TRACE_BUF_SIZE_NUM: { + if (eal_trace_bufsz_args_save(optarg) < 0) { + RTE_LOG(ERR, EAL, "invalid parameters for --" + OPT_TRACE_BUF_SIZE "\n"); + return -1; + } + break; + } + case OPT_LCORES_NUM: if (eal_parse_lcores(optarg) < 0) { RTE_LOG(ERR, EAL, "invalid parameter for --" @@ -1725,6 +1735,13 @@ eal_common_usage(void) " By default, trace output will created at\n" " HOME directory and parameter must be\n" " specified once only\n" + " --"OPT_TRACE_BUF_SIZE"=\n" + " Specify maximum size of allocated memory\n" + " for trace output for each thread. Valid\n" + " unit can be either 'B|K|M' for 'Bytes',\n" + " 'KBytes' and 'MBytes' respectively.\n" + " Default is 1MB and parameter must be\n" + " specified once only\n" " -v Display version information on startup\n" " -h, --help This help\n" " --"OPT_IN_MEMORY" Operate entirely in memory. This will\n" diff --git a/lib/librte_eal/common/eal_common_trace.c b/lib/librte_eal/common/eal_common_trace.c index 697cdbcf3..a6271d984 100644 --- a/lib/librte_eal/common/eal_common_trace.c +++ b/lib/librte_eal/common/eal_common_trace.c @@ -64,6 +64,9 @@ eal_trace_init(void) /* Generate UUID ver 4 with total size of events and number of events */ trace_uuid_generate(); + /* Apply buffer size configuration for trace output */ + trace_bufsz_args_apply(); + /* Generate CTF TDSL metadata */ if (trace_metadata_create()) goto fail; diff --git a/lib/librte_eal/common/eal_common_trace_utils.c b/lib/librte_eal/common/eal_common_trace_utils.c index 013415ba2..a45e731b2 100644 --- a/lib/librte_eal/common/eal_common_trace_utils.c +++ b/lib/librte_eal/common/eal_common_trace_utils.c @@ -238,6 +238,36 @@ trace_level_args_apply(const char *arg) return -1; } +int +eal_trace_bufsz_args_save(char const *optarg) +{ + struct trace *trace = trace_obj_get(); + uint64_t bufsz; + + if (optarg == NULL) { + trace_err("no optarg is passed\n"); + return -EINVAL; + } + + bufsz = rte_str_to_size(optarg); + if (bufsz == 0) { + trace_err("buffer size cannot be zero\n"); + return -EINVAL; + } + + trace->buff_len = bufsz; + return 0; +} + +void +trace_bufsz_args_apply(void) +{ + struct trace *trace = trace_obj_get(); + + if (trace->buff_len == 0) + trace->buff_len = 1024 * 1024; /* 1MB */ +} + int eal_trace_dir_args_save(char const *optarg) { diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h index 8c8283165..cc7e0ea70 100644 --- a/lib/librte_eal/common/eal_options.h +++ b/lib/librte_eal/common/eal_options.h @@ -37,6 +37,8 @@ enum { OPT_TRACE_LEVEL_NUM, #define OPT_TRACE_DIR "trace-dir" OPT_TRACE_DIR_NUM, +#define OPT_TRACE_BUF_SIZE "trace-bufsz" + OPT_TRACE_BUF_SIZE_NUM, #define OPT_MASTER_LCORE "master-lcore" OPT_MASTER_LCORE_NUM, #define OPT_MBUF_POOL_OPS_NAME "mbuf-pool-ops-name" diff --git a/lib/librte_eal/common/eal_trace.h b/lib/librte_eal/common/eal_trace.h index e1754de63..11e5cc16f 100644 --- a/lib/librte_eal/common/eal_trace.h +++ b/lib/librte_eal/common/eal_trace.h @@ -101,6 +101,7 @@ struct trace_point_head *trace_list_head_get(void); const char *trace_mode_to_string(enum rte_trace_mode_e mode); const char *trace_area_to_string(enum trace_area_e area); int trace_level_args_apply(const char *arg); +void trace_bufsz_args_apply(void); bool trace_has_duplicate_entry(void); void trace_uuid_generate(void); int trace_metadata_create(void); @@ -115,5 +116,6 @@ void eal_trace_fini(void); int eal_trace_level_args_save(const char *optarg); void eal_trace_level_args_free(void); int eal_trace_dir_args_save(const char *optarg); +int eal_trace_bufsz_args_save(const char *optarg); #endif /* __EAL_TRACE_H */ -- 2.25.1