From patchwork Mon Sep 13 12:27:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 12488727 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 8E8F0C433F5 for ; Mon, 13 Sep 2021 12:28:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7709960555 for ; Mon, 13 Sep 2021 12:28:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240006AbhIMM3k (ORCPT ); Mon, 13 Sep 2021 08:29:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240008AbhIMM3j (ORCPT ); Mon, 13 Sep 2021 08:29:39 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABC2EC061760 for ; Mon, 13 Sep 2021 05:28:23 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id b21-20020a1c8015000000b003049690d882so3992468wmd.5 for ; Mon, 13 Sep 2021 05:28:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rgKSGpz75JPloOaC/1DcOk+gg+XSb9yeocHeU0wjVV0=; b=H79l7xWdS6wROyXk9T/okuK6E0MvVIf21WGllpDWL+PxAO8ROZt0ALb7yWhvx0A+Bl TyLczSAABpAT4kG2uU8u9eWkMKUBLROPwg3LACGUA65oI+/rGIVMOwcBkAhWd0cB+6D1 zwskiqyuU2mU9jP9Hj8ijtKhqSpKxZ7KUcJp9StQ3AX5ba+CT+TFSbFtp9GZHaycP3+H j3qRzk38peh1vb/HcQ+8Wxci+uHPMcq/VOHGHKi7wdGdchR/uWD0RW8H1MFT7JyVLs2c QnpNfv4KCu0+Q+GbDIHcNyjutJfCRGUCghj7wt6oXOA6a7LJ4c15mvAw+gRZFIXGpbXL 6Fug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rgKSGpz75JPloOaC/1DcOk+gg+XSb9yeocHeU0wjVV0=; b=3Qfaf8Wc1RZ495G3lX+EfSRsQnYvg3AUnoEdJTZiU3GUOLDtiUcNiC7iJ5fo816iLX DQhX5Pq/cdK/3Ape34ifMXBlBieWgFjGm8D5DthTuGgX35WgHyD8Dff44efUIAeRqbGY elwAnL4dcr+71aA2TMaHZ7oHr3NtATG4NhW4dM/V5mIa0EvMtT2BB/roqxN8W52vmkCJ 5hCMff/C0n6N7/hWyDNjLM/oaFyU/5dBmgYtkGy1LWKTCpVzrHsl+OOpI08q7IoeNx49 nrTBOAv44k8fEfxWmlh058j4vTjLEOmVqYFqj8uQN7dsbK7zOqSR7vNWic9j9Z4UR8mq Rhkg== X-Gm-Message-State: AOAM532HHtK1YdjQaRvYfzFro4RtGShNjb0wSDdn6WGSwXPd+1KPv0f6 5hgLo9GbA0Ndp9xWKxZfPX4= X-Google-Smtp-Source: ABdhPJzAS0eiS4t9i2BK2S6AZuMBB7fJTiU/n2WC/QWaUWERm0vxTocAw+03iOoMc8q3AnNH5MeI8w== X-Received: by 2002:a05:600c:4f52:: with SMTP id m18mr10738905wmq.34.1631536102276; Mon, 13 Sep 2021 05:28:22 -0700 (PDT) Received: from oberon.zico.biz ([83.222.187.186]) by smtp.gmail.com with ESMTPSA id z6sm6839689wmp.1.2021.09.13.05.28.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 05:28:21 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH v2 21/21] trace-cmd report: Init the top trace instance earlier Date: Mon, 13 Sep 2021 15:27:59 +0300 Message-Id: <20210913122759.3672494-22-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210913122759.3672494-1-tz.stoyanov@gmail.com> References: <20210913122759.3672494-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Moved initialization of the instance before call to the tracecmd_cpus() API. This change is required for the upcoming trace file changes, where CPU count is set when the trace data are initialized. Signed-off-by: Tzvetomir Stoyanov (VMware) --- tracecmd/trace-read.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c index 02f75cb9..f7ffb89e 100644 --- a/tracecmd/trace-read.c +++ b/tracecmd/trace-read.c @@ -1215,6 +1215,11 @@ static void read_data_info(struct list_head *handle_list, enum output_type otype list_for_each_entry(handles, handle_list, list) { int cpus; + if (!tracecmd_is_buffer_instance(handles->handle)) { + ret = tracecmd_init_data(handles->handle); + if (ret < 0) + die("failed to init data"); + } cpus = tracecmd_cpus(handles->handle); handles->cpus = cpus; handles->last_timestamp = calloc(cpus, sizeof(*handles->last_timestamp)); @@ -1225,9 +1230,6 @@ static void read_data_info(struct list_head *handle_list, enum output_type otype if (tracecmd_is_buffer_instance(handles->handle)) continue; - ret = tracecmd_init_data(handles->handle); - if (ret < 0) - die("failed to init data"); if (align_ts) { ts = tracecmd_get_first_ts(handles->handle); if (first || first_ts > ts)