#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-3.0-or-later """breadcrumbs.py -- pure parser for LibreMail on-device perf breadcrumbs. This module is the *core* of the device-testing harness and is intentionally free of any I/O, ``adb``, or device dependency so it can be unit-tested against the saved logcat captures from the manual perf run (see ``tests/test_breadcrumbs.py`` and ``tests/fixtures/perf-extract-sample.log``). It parses two things: 1. A raw ``adb logcat -v threadtime`` line into its fields (:func:`parse_logcat_line`). 2. The message payload of the four perf tags into typed events (:func:`parse_breadcrumb` and the per-tag helpers). Breadcrumb formats (verbatim from the app source, all PII-free): * ``ImapPerf: connect=ms work=ms live=`` -- ``ImapClient`` generic per-operation timing; ``op`` is a short label (``prefetch-body``, ``backfill-page``, ``body-fetch``, ``imap`` ...). * ``ImapPerf: body-fetch select=ms body=ms flag=ms rfc822=B chars= att=`` -- ``ImapClient`` detailed body-fetch phase split (emitted just before the generic ``body-fetch connect=.. work=.. live=..`` line for the same fetch). * ``MailReader: openMessage folder=