From patchwork Tue Oct 18 16:53:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 38807 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp2206711pzb; Tue, 18 Oct 2022 09:54:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64tZuf1wN/lpGa3b8MCJy+Q7S3WS6GnP/JZf2EoEr7VHSkRF2rsZTERjwwd1HVFC9YuvgT X-Received: by 2002:a17:907:808:b0:730:54cc:b597 with SMTP id wv8-20020a170907080800b0073054ccb597mr3220459ejb.434.1666112079085; Tue, 18 Oct 2022 09:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666112079; cv=none; d=google.com; s=arc-20160816; b=UK/LZp/jIO9Th1dzGmKX+JcCh4QaPCgqM+RnMDJjj9LpIqNaNgvRH3eCrzZJNewb8Q xlZfaD76kH9sPfu2d34536KDJjXcSPur/d4ZKAhuwregNpMyX++mBzsaZYC7bX5Ynf36 JpqJeWODv5x5k2Ye9iiq2x9mxHZN11BNiDsf36yFerBB5VoDCS5lG8XHnw/PdWML9lIs 7dpG7KlisI6BRSDiwnTl+GsSc+/6FSbqMR9bGTYkxSU/cmsabII88rXAdUDioldmrZI4 qskLSf22MjlEFLNMDySz44zX11oh+G/H3a16/+fXJw0+OvuX7ED8KUDcKBs2n9Xlu1Ws riow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=pujeQs7W1VbvlJN8nyvvJb4HGvyiAdP0mQSzz6+mvyo=; b=ftoRDHJBzAel9N/lE1WUPa6fnNHNQ3QDCGbq8OwiR/HooglHArC8B0o1EXJ5H4/u4v X4EDajZ/vq/JNPywospr/ZxBu5EBMoZm/ZYcXZ5x7GX7JVkR2dgM9g5gqZ9mzHB3uf/f kKMfsHUi93WcCtczn9O0JeziYK9vl7X5XkEZadQOHXsbt1JoXRW36GXl5ZTUeVphidju 9JbLixmIVRgETO5ttxfFc7jQY9jdBcXJj3wd+TOAKo1Eq6N+oVHzX5/4JtniZqExVe86 eryuf8W8R+DuG/vLzN+VQckOZMRKg5DwSo/U2UyS0n8iPFuE+dU+y6C4ee9cBffnbr+2 1ncQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dr8-20020a170907720800b0078b3edae43csi13839326ejc.37.2022.10.18.09.54.38; Tue, 18 Oct 2022 09:54:39 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4796768BD5F; Tue, 18 Oct 2022 19:54:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2637268BBFE for ; Tue, 18 Oct 2022 19:54:01 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 94E852400F4 for ; Tue, 18 Oct 2022 18:54:00 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id XbPZCY1qFP-B for ; Tue, 18 Oct 2022 18:54:00 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id CF64E2404F7 for ; Tue, 18 Oct 2022 18:53:58 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id C1CBE3A0922 for ; Tue, 18 Oct 2022 18:53:58 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 18 Oct 2022 18:53:05 +0200 Message-Id: <20221018165307.28242-2-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221018165307.28242-1-anton@khirnov.net> References: <20221018165307.28242-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/4] lavc/pthread_frame: set worker thread names X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: +U92+9Qf9vqS --- libavcodec/pthread_frame.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index f8fddc5e4d..7cd352160e 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -179,6 +179,17 @@ static void async_unlock(FrameThreadContext *fctx) pthread_mutex_unlock(&fctx->async_mutex); } +static void thread_set_name(PerThreadContext *p) +{ + AVCodecContext *avctx = p->avctx; + int idx = p - p->parent->threads; + char name[16]; + + snprintf(name, sizeof(name), "d:%.7s:ft%d", avctx->codec->name, idx); + + ff_thread_setname(name); +} + /** * Codec worker thread. * @@ -192,6 +203,8 @@ static attribute_align_arg void *frame_worker_thread(void *arg) AVCodecContext *avctx = p->avctx; const FFCodec *codec = ffcodec(avctx->codec); + thread_set_name(p); + pthread_mutex_lock(&p->mutex); while (1) { while (atomic_load(&p->state) == STATE_INPUT_READY && !p->die)