systrace/perfetto中需要actrace打tag相关方法-车载车机framework系统开发实战

Android6.0 显示系统(六) 图像的输出过程 上篇博客分析到SurfaceFlinger收到了VSync信号后,调用了handleMessageRefresh函数,这篇博客主要就是分析这个函数,我们先看看它的代码: void SurfaceFlinger::handleMessageRefresh() { ATRACE_CALL(); static nsecs_t previousExpectedPresent = 0; 阅读详情
AI摘要

本文介绍了Android系统中的ATRACE技术,包括如何通过ATRACE_TAG定义和使用方法,以及atrace_call、ATRACE_NAME等实用宏的原理和用法,展示了如何在Java应用中进行trace打印和控制.

背景:

经常在看systrace、perfetto相关trace时候,其实我们主要就是看各种方法的调用tag,如下图所示
在这里插入图片描述正因为有了系统中各个地方埋下的这些tag,才让我们可以根据这些方法tag分析出整个系统的运行情况。但是大家有没有想过,请问这些tag是怎么打上去的?如果我们自己要打印自己方法的tag应该怎么搞?

使用atrace相关类方法介绍

这里还需要看对应的trace源码是最全面的
路径:system/core/libcutils/include/cutils/trace.h
源码:

/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _LIBS_CUTILS_TRACE_H
#define _LIBS_CUTILS_TRACE_H

#include <inttypes.h>
#include <stdatomic.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#include <unistd.h>
#include <cutils/compiler.h>

__BEGIN_DECLS

/**
 * The ATRACE_TAG macro can be defined before including this header to trace
 * using one of the tags defined below.  It must be defined to one of the
 * following ATRACE_TAG_* macros.  The trace tag is used to filter tracing in
 * userland to avoid some of the runtime cost of tracing when it is not desired.
 *
 * Defining ATRACE_TAG to be ATRACE_TAG_ALWAYS will result in the tracing always
 * being enabled - this should ONLY be done for debug code, as userland tracing
 * has a performance cost even when the trace is not being recorded.  Defining
 * ATRACE_TAG to be ATRACE_TAG_NEVER or leaving ATRACE_TAG undefined will result
 * in the tracing always being disabled.
 *
 * ATRACE_TAG_HAL should be bitwise ORed with the relevant tags for tracing
 * within a hardware module.  For example a camera hardware module would set:
 * #define ATRACE_TAG  (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
 *
 * Keep these in sync with frameworks/base/core/java/android/os/Trace.java.
 */
#define ATRACE_TAG_NEVER            0       // This tag is never enabled.
#define ATRACE_TAG_ALWAYS           (1<<0)  // This tag is always enabled.
#define ATRACE_TAG_GRAPHICS         (1<<1)
#define ATRACE_TAG_INPUT            (1<<2)
#define ATRACE_TAG_VIEW             (1<<3)
#define ATRACE_TAG_WEBVIEW          (1<<4)
#define ATRACE_TAG_WINDOW_MANAGER   (1<<5)
#define ATRACE_TAG_ACTIVITY_MANAGER (1<<6)
#define ATRACE_TAG_SYNC_MANAGER     (1<<7)
#define ATRACE_TAG_AUDIO            (1<<8)
#define ATRACE_TAG_VIDEO            (1<<9)
#define ATRACE_TAG_CAMERA           (1<<10)
#define ATRACE_TAG_HAL              (1<<11)
#define ATRACE_TAG_APP              (1<<12)
#define ATRACE_TAG_RESOURCES        (1<<13)
#define ATRACE_TAG_DALVIK           (1<<14)
#define ATRACE_TAG_RS               (1<<15)
#define ATRACE_TAG_BIONIC           (1<<16)
#define ATRACE_TAG_POWER            (1<<17)
#define ATRACE_TAG_PACKAGE_MANAGER  (1<<18)
#define ATRACE_TAG_SYSTEM_SERVER    (1<<19)
#define ATRACE_TAG_DATABASE         (1<<20)
#define ATRACE_TAG_NETWORK          (1<<21)
#define ATRACE_TAG_ADB              (1<<22)
#define ATRACE_TAG_VIBRATOR         (1<<23)
#define ATRACE_TAG_AIDL             (1<<24)
#define ATRACE_TAG_NNAPI            (1<<25)
#define ATRACE_TAG_RRO              (1<<26)
#define ATRACE_TAG_THERMAL          (1 << 27)
#define ATRACE_TAG_LAST             ATRACE_TAG_THERMAL

// Reserved for initialization.
#define ATRACE_TAG_NOT_READY        (1ULL<<63)

#define ATRACE_TAG_VALID_MASK ((ATRACE_TAG_LAST - 1) | ATRACE_TAG_LAST)

#ifndef ATRACE_TAG
#define ATRACE_TAG ATRACE_TAG_NEVER
#elif ATRACE_TAG > ATRACE_TAG_VALID_MASK
#error ATRACE_TAG must be defined to be one of the tags defined in cutils/trace.h
#endif

/**
 * Opens the trace file for writing and reads the property for initial tags.
 * The atrace.tags.enableflags property sets the tags to trace.
 * This function should not be explicitly called, the first call to any normal
 * trace function will cause it to be run safely.
 */
void atrace_setup();

/**
 * If tracing is ready, set atrace_enabled_tags to the system property
 * debug.atrace.tags.enableflags. Can be used as a sysprop change callback.
 */
void atrace_update_tags();

/**
 * Set whether tracing is enabled for the current process.  This is used to
 * prevent tracing within the Zygote process.
 */
void atrace_set_tracing_enabled(bool enabled);

/**
 * This is always set to false. This forces code that uses an old version
 * of this header to always call into atrace_setup, in which we call
 * atrace_init unconditionally.
 */
extern atomic_bool atrace_is_ready;

/**
 * Set of ATRACE_TAG flags to trace for, initialized to ATRACE_TAG_NOT_READY.
 * A value of zero indicates setup has failed.
 * Any other nonzero value indicates setup has succeeded, and tracing is on.
 */
extern uint64_t atrace_enabled_tags;

/**
 * Handle to the kernel's trace buffer, initialized to -1.
 * Any other value indicates setup has succeeded, and is a valid fd for tracing.
 */
extern int atrace_marker_fd;

/**
 * atrace_init readies the process for tracing by opening the trace_marker file.
 * Calling any trace function causes this to be run, so calling it is optional.
 * This can be explicitly run to avoid setup delay on first trace function.
 */
#define ATRACE_INIT() atrace_init()
#define ATRACE_GET_ENABLED_TAGS() atrace_get_enabled_tags()

void atrace_init();
uint64_t atrace_get_enabled_tags();

/**
 * Test if a given tag is currently enabled.
 * Returns nonzero if the tag is enabled, otherwise zero.
 * It can be used as a guard condition around more expensive trace calculations.
 */
#define ATRACE_ENABLED() atrace_is_tag_enabled(ATRACE_TAG)
static inline uint64_t atrace_is_tag_enabled(uint64_t tag)
{
    return atrace_get_enabled_tags() & tag;
}

/**
 * Trace the beginning of a context.  name is used to identify the context.
 * This is often used to time function execution.
 */
#define ATRACE_BEGIN(name) atrace_begin(ATRACE_TAG, name)
static inline void atrace_begin(uint64_t tag, const char* name)
{
    if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
        void atrace_begin_body(const char*);
        atrace_begin_body(name);
    }
}

/**
 * Trace the end of a context.
 * This should match up (and occur after) a corresponding ATRACE_BEGIN.
 */
#define ATRACE_END() atrace_end(ATRACE_TAG)
static inline void atrace_end(uint64_t tag)
{
    if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
        void atrace_end_body();
        atrace_end_body();
    }
}

/**
 * Trace the beginning of an asynchronous event. Unlike ATRACE_BEGIN/ATRACE_END
 * contexts, asynchronous events do not need to be nested. The name describes
 * the event, and the cookie provides a unique identifier for distinguishing
 * simultaneous events. The name and cookie used to begin an event must be
 * used to end it.
 */
#define ATRACE_ASYNC_BEGIN(name, cookie) \
    atrace_async_begin(ATRACE_TAG, name, cookie)
static inline void atrace_async_begin(uint64_t tag, const char* name,
        int32_t cookie)
{
    if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
        void atrace_async_begin_body(const char*, int32_t);
        atrace_async_begin_body(name, cookie);
    }
}

/**
 * Trace the end of an asynchronous event.
 * This should have a corresponding ATRACE_ASYNC_BEGIN.
 */
#define ATRACE_ASYNC_END(name, cookie) atrace_async_end(ATRACE_TAG, name, cookie)
static inline void atrace_async_end(uint64_t tag, const char* name, int32_t cookie)
{
    if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
        void atrace_async_end_body(const char*, int32_t);
        atrace_async_end_body(name, cookie);
    }
}

/**
 * Trace the beginning of an asynchronous event. In addition to the name and a
 * cookie as in ATRACE_ASYNC_BEGIN/ATRACE_ASYNC_END, a track name argument is
 * provided, which is the name of the row where this async event should be
 * recorded. The track name, name, and cookie used to begin an event must be
 * used to end it.
 */
#define ATRACE_ASYNC_FOR_TRACK_BEGIN(track_name, name, cookie) \
    atrace_async_for_track_begin(ATRACE_TAG, track_name, name, cookie)
static inline void atrace_async_for_track_begin(uint64_t tag, const char* track_name,
                                                const char* name, int32_t cookie) {
    if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
        void atrace_async_for_track_begin_body(const char*, const char*, int32_t);
        atrace_async_for_track_begin_body(track_name, name, cookie);
    }
}

/**
 * Trace the end of an asynchronous event.
 * This should correspond to a previous ATRACE_ASYNC_FOR_TRACK_BEGIN.
 */
#define ATRACE_ASYNC_FOR_TRACK_END(track_name, name, cookie) \
    atrace_async_for_track_end(ATRACE_TAG, track_name, name, cookie)
static inline void atrace_async_for_track_end(uint64_t tag, const char* track_name,
                                              const char* name, int32_t cookie) {
    if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
        void atrace_async_for_track_end_body(const char*, const char*, int32_t);
        atrace_async_for_track_end_body(track_name, name, cookie);
    }
}

/**
 * Trace an instantaneous context. name is used to identify the context.
 *
 * An "instant" is an event with no defined duration. Visually is displayed like a single marker
 * in the timeline (rather than a span, in the case of begin/end events).
 *
 * By default, instant events are added into a dedicated track that has the same name of the event.
 * Use atrace_instant_for_track to put different instant events into the same timeline track/row.
 */
#define ATRACE_INSTANT(name) atrace_instant(ATRACE_TAG, name)
static inline void atrace_instant(uint64_t tag, const char* name) {
    if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
        void atrace_instant_body(const char*);
        atrace_instant_body(name);
    }
}

/**
 * Trace an instantaneous context. name is used to identify the context.
 * track_name is the name of the row where the event should be recorded.
 *
 * An "instant" is an event with no defined duration. Visually is displayed like a single marker
 * in the timeline (rather than a span, in the case of begin/end events).
 */
#define ATRACE_INSTANT_FOR_TRACK(trackName, name) \
    atrace_instant_for_track(ATRACE_TAG, trackName, name)
static inline void atrace_instant_for_track(uint64_t tag, const char* track_name,
                                            const char* name) {
    if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
        void atrace_instant_for_track_body(const char*, const char*);
        atrace_instant_for_track_body(track_name, name);
    }
}

/**
 * Traces an integer counter value.  name is used to identify the counter.
 * This can be used to track how a value changes over time.
 */
#define ATRACE_INT(name, value) atrace_int(ATRACE_TAG, name, value)
static inline void atrace_int(uint64_t tag, const char* name, int32_t value)
{
    if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
        void atrace_int_body(const char*, int32_t);
        atrace_int_body(name, value);
    }
}

/**
 * Traces a 64-bit integer counter value.  name is used to identify the
 * counter. This can be used to track how a value changes over time.
 */
#define ATRACE_INT64(name, value) atrace_int64(ATRACE_TAG, name, value)
static inline void atrace_int64(uint64_t tag, const char* name, int64_t value)
{
    if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
        void atrace_int64_body(const char*, int64_t);
        atrace_int64_body(name, value);
    }
}

__END_DECLS

#endif // _LIBS_CUTILS_TRACE_H

日常使用trace打TAG其实本质上都是基于这个类的,在这个的基础上会加一些额外包装
比如常见的几个方法:
1、ATRACE_CALL();
这个方法,代表对一个function的开头和结尾进行tag,它的源码如下
#define ATRACE_CALL() ATRACE_NAME(FUNCTION)
即本质调用的是ATRACE_NAME

调用如下:
在这里插入图片描述

ATRACE_NAME方法

这个方法的本质定义如下

//这里的ATRACE_NAME其实本质是个临时对象构造和析构进行调用的atrace_begin和atrace_end,这两个其实就是trace.h原始方法
#define ATRACE_NAME(name) ::android::ScopedTrace PASTE(___tracer, __LINE__)(ATRACE_TAG, name)
namespace android {
//临时对象,调用该时候该对象刚好构造,一般方法域结束就代表作用无效了,因为会进行对象的析构
class ScopedTrace {
public:
    inline ScopedTrace(uint64_t tag, const char* name) : mTag(tag) {
        atrace_begin(mTag, name);//构造时候进行begin
            }

    inline ~ScopedTrace() {
        atrace_end(mTag);//析构时候代表trace结束end
    }

private:
    uint64_t mTag;
};

调用如下:
在这里插入图片描述
效果如下:
在这里插入图片描述
其他常见还有

ATRACE_INT

具体源码:

/**
 * Traces an integer counter value.  name is used to identify the counter.
 * This can be used to track how a value changes over time.
 */
#define ATRACE_INT(name, value) atrace_int(ATRACE_TAG, name, value)
static inline void atrace_int(uint64_t tag, const char* name, int32_t value)
{
    if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
        void atrace_int_body(const char*, int32_t);
        atrace_int_body(name, value);
    }
}

代码调用:
在这里插入图片描述
效果如下:
![在这里插入图片描述](https://img-blog.csdnimg.cn/6f4e7a7f62c24145af81e537611ba155.png#pic_center

trace相关实战使用:

1、引入相关的头文件及相关库
#include <utils/Trace.h>
编译时候还得考率相关utils的lib是否引入
如这里以截图代码为例就有引入libutils
frameworks/base/cmds/screencap/Android.bp

cc_binary {
    name: "screencap",

    srcs: ["screencap.cpp"],

    shared_libs: [
        "libcutils",
        "libutils",
        "libbinder",
        "libjnigraphics",
        "libui",
        "libgui",
    ],

    cflags: [
        "-Wall",
        "-Werror",
        "-Wunused",
        "-Wunreachable-code",
    ],
}

2、定义好相关的TAG

 #undef ATRACE_TAG
#define ATRACE_TAG ATRACE_TAG_GRAPHICS

这里就选了一个ATRACE_TAG_GRAPHICS即graphics这个组

3、调用相关actrace方法
ATRACE_CALL
ATRACE_NAME
一般针对整个方法或者单独作用域,ATRACE_CALL和ATRACE_NAME本质没有区别,只是把名字变成了function的name
在这里插入图片描述具体效果如下:
在这里插入图片描述优点:只需要一个调用既可以实现tag打印,自动跟随作用域进行tag的结束
缺点:需要自己熟练掌握好作用域,没有可以手动控制的tag结束的点

4、相关灵活控制开始与结束的trace方法
直接使用atrace_begin和atrace_end方法,使用如下:

GraphicBuffer::GraphicBuffer()
    : BASE(), mOwner(ownData), mBufferMapper(GraphicBufferMapper::get()),
      mInitCheck(NO_ERROR), mId(getUniqueId()), mGenerationNumber(0)
{
    ATRACE_NAME("GraphicBuffer::GraphicBuffer()1");
    atrace_begin(ATRACE_TAG, "GraphicBuffer 1");
    width  =
    height =
    stride =
    format =
    usage_deprecated = 0;
    atrace_end(ATRACE_TAG);
    usage  = 0;
    layerCount = 0;
    handle = nullptr;
}

具体效果如下:
在这里插入图片描述
同时也可以使用对应宏定义:
ATRACE_BEGIN(name);
ATRACE_END();
来控制
在这里插入图片描述
执行后效果如下:
在这里插入图片描述

ATRACE_FORMAT

有时候想要Trace上的显示的标签是动态可以变化的比如打印一个数字,或者是某个变量的值
在这里插入图片描述比如上面这种,你看到很多数字其实都是每次执行都是不一样的,那么这个时候打印trace名字时候,就会要求有动态变化的需求,需要把变量值也打印出来,这个时候就需要使用ATRACE_FORMAT这个宏,当然你可以自己每次把变量组合到一个string变量,然后ATRACE_NAME打印这个string既可以,但是这样比较麻烦
使用方式:
ATRACE_FORMAT和上面的ATRACE_NAME没啥区别
不过include文件夹有区别需要引入TraceUtils
#include <gui/TraceUtils.h>
调用方式和打log没啥差别:

  ATRACE_FORMAT("%s %" PRId64 " vsyncIn %.2fms%s", __func__, vsyncId, vsyncIn,
                  mExpectedPresentTime == expectedVsyncTime ? "" : " (adjusted)");

相关源码如下:
frameworks/native/include/gui/TraceUtils.h

#pragma once

#include <stdarg.h>

#include <cutils/trace.h>
#include <utils/Trace.h>

#define ATRACE_FORMAT(fmt, ...)           \
    TraceUtils::TraceEnder __traceEnder = \
            (TraceUtils::atraceFormatBegin(fmt, ##__VA_ARGS__), TraceUtils::TraceEnder())

#define ATRACE_FORMAT_BEGIN(fmt, ...) TraceUtils::atraceFormatBegin(fmt, ##__VA_ARGS__)

namespace android {

class TraceUtils {
public:
    class TraceEnder {
    public:
        ~TraceEnder() { ATRACE_END(); }
    };

    static void atraceFormatBegin(const char* fmt, ...) {
        if (CC_LIKELY(!ATRACE_ENABLED())) return;

        const int BUFFER_SIZE = 256;
        va_list ap;
        char buf[BUFFER_SIZE];

        va_start(ap, fmt);
        vsnprintf(buf, BUFFER_SIZE, fmt, ap);
        va_end(ap);

        ATRACE_BEGIN(buf);
    }

}; // class TraceUtils

} /* namespace android */

java端的trace打印

app层面时候也有trace打印方式

  Trace.traceBegin(Trace.TRACE_TAG_ALWAYS,"aaaaa");//开始trace 字符为aaaaa
  Trace.traceEnd(Trace.TRACE_TAG_ALWAYS);//结束trace

源码如下:
frameworks/base/core/java/android/os/Trace.java


    /**
     * Writes a trace message to indicate that a given section of code has
     * begun. Must be followed by a call to {@link #traceEnd} using the same
     * tag.
     *
     * @param traceTag The trace tag.
     * @param methodName The method name to appear in the trace.
     *
     * @hide
     */
    @UnsupportedAppUsage
    @SystemApi(client = MODULE_LIBRARIES)
    public static void traceBegin(long traceTag, @NonNull String methodName) {
        if (isTagEnabled(traceTag)) {
            nativeTraceBegin(traceTag, methodName);
        }
    }

    /**
     * Writes a trace message to indicate that the current method has ended.
     * Must be called exactly once for each call to {@link #traceBegin} using the same tag.
     *
     * @param traceTag The trace tag.
     *
     * @hide
     */
    @UnsupportedAppUsage
    @SystemApi(client = MODULE_LIBRARIES)
    public static void traceEnd(long traceTag) {
        if (isTagEnabled(traceTag)) {
            nativeTraceEnd(traceTag);
        }
    }

具体使用方法:

  protected void onStart() {
        Trace.traceBegin(Trace.TRACE_TAG_ALWAYS,"Settings Home onStart()");
        ((SettingsApplication) getApplication()).setHomeActivity(this);
        super.onStart();
        doAidlHalCall();
        Trace.traceEnd(Trace.TRACE_TAG_ALWAYS);
    }

然后再抓对应trace
在这里插入图片描述

是不是把我们Settings Home onStart()在trace中给打印出来了

更多framework干货请关注“千里马学框架”

android使用systrace框架sampling 手动搜集数据并分析 前话:计算机行业需要学习的知识太多,有时遇到一个不熟悉问题,只能依靠网络;网络上的答案有好有坏,也可能是环境与自己的环境不一样,导致给出的解决办法不适用。但是网络上有80%的答案都是拷贝粘贴,而且都不适用,不知道给出这些答案的人,最后到底解决答案了没有,针对这种情况,不知道有多少人和我一样会感到无奈甚至是气愤。改变不了环境,只能坚持自己好了。 问题背景(读者若对文中涉及到的知识不了解,找其他贴... 阅读详情

相关推荐

ATRACE 调试框架在 Camera 性能调优中的应用:帧时序分析 × 模块耗时定位 × 图像链路优化实战

在 Android Camera 系统的性能优化过程中,ATRACE 调试框架扮演着至关重要的角色。通过精确标记系统各模块(如 Camera HAL、Framework、SurfaceFlinger)的关键耗时节点,开发者可借助 `systrace` 或 `perfetto` 工具构建完整的帧级时间轴,从而发现卡顿、丢帧、Preview 延迟、拍照慢等问题的真实根因。本文将以实战为导向,系统讲解如何启用 ATRACE,识别关键 trace 点,解析 Camera 图像链路中各阶段的时序关系,并提供工程层调优

努力分享一些人工智能、计算机视觉、影像等相关的知识干货! 1301

trace抓取

打印到trace: 应用层: ATRACE_CALL(); 定义ATRACE_TAG:Hwcomposer使用了ATRACE_TAG_GRAPHICS,表示它和Graphics相关。 ATRACE_INIT:用于统计某个变量使用的情况。下文将见到代码中”VSYNC”的统计结果。 ATRACE_CALL:用于统计函数的调用情况。 内核层: trace_printk("1\n")

简单的过客 8573

如何实现C++动态调用动态链接库(DLL或SO)

使用函数指针来定义函数的类型,以便在动态库中找到的函数能够正确地调用。函数指针的类型必须与函数的签名(参数类型和返回类型)匹配。// 函数指针#ifdef _MSC_VER // Windows环境下的导出声明__declspec。

weixin_48438353的博客 7994

Android——systrace使用分析

前文有分析使用linux下的trace Linux trace使用入门 ,这里再次记录下android系统中比较实用的性能分析工具 systrace撰写不易,转载需注明出处:http://blog.csdn.net/jscese/article/details/48373319本文来自 【jscese】的博客!前提systrace由kernel中的ftrace支持,kernel中的trace 配置开

jscese 3万+

Abaqus 单元与全局刚度矩阵导出实战指南:从INP修改到结果解析

本文提供了Abaqus中导出单元刚度矩阵和全局刚度矩阵的完整实战指南。通过详细步骤讲解INP文件修改、关键指令插入及结果文件解析,帮助工程师、研究人员和二次开发者深入理解有限元软件内核,实现理论验证、二次开发与深度问题调试。

k8s6orchestrator的博客 910

Rockit VDEC解码实战:从零构建高效视频处理流水线

本文详细介绍了Rockit VDEC硬件解码模块在RK3568/RK3588平台的应用实践,涵盖开发环境配置、MPI接口使用、码流发送模式选择、内存管理优化及多路解码系统构建。通过实战案例展示如何利用VDEC实现高效视频处理流水线,显著降低CPU占用率,提升嵌入式多媒体开发效率。

ol789012的博客 314

Android代码添加systrace跟踪

android 4.3系统上,应用可以使用      import android.os.Trace;      Trace.beginSection("TEST");      Trace.endSection(); 添加systrace跟踪,然后通过thon systrace.py --app=TEST 指定apk。 framework的java层代码里面添加systrace跟踪

oujunli的专栏 2万+

SRT公网点对点传输及搭建SRT流媒体服务器

SRT是一种开源传输技术,它是基于UDP协议的,与RTMP不同的是,它具有高码率低延迟的传输特性,加强了在复杂不稳定网络环境中的传输可靠性,提升了不可预测的网络环境上的流传输性能。它不像NDI那样只适用于局域网传输,它更适用于公网环境下的信号传输。 S代表Secure,即安全加密的视频流,R代表Reliable,即具有从数据严重丢包中恢复的可靠性,T代表Transport,即动态适应变化的网络状况。 在音视频数据包传输的过程中,SRT会检测并适应两个传输点之间的实时网络状况,有助于补偿由于网络的拥塞而引起的

罗宇。的媒体技术工作室 1万+

android追踪工具Trace概述

systrace ​ systrace 是分析 Android 设备性能的主要工具。不过,它实际上是其他工具的封装容器:它是 atrace 的主机端封装容器,是用于控制用户空间跟踪和设置 ftrace 的设备端可执行文件,也是 Linux 内核中的主要跟踪机制。systrace 使用 atrace 来启用跟踪,然后读取 ftrace 缓冲区并将其全部封装到一个独立的 HTML 查看器中(虽然较新的内核支持 Linux 增强型柏克莱封包过滤器 (eBPF),但以下文档内容仅适用于 3.18 内核(无 eFPF

垮掉的一代人的专栏 1万+

LabVIEW事件结构避坑指南:为什么你的‘确定按钮’事件有时会失灵?

本文深入探讨了LabVIEW事件结构中'确定按钮'事件失灵的常见原因及解决方案。从事件队列机制到事件类型选择,详细分析了事件丢失的五大原因,包括事件处理耗时过长、事件类型选择不当等,并提供了优化登录界面案例的实用建议。掌握这些技巧可显著提升LabVIEW用户界面的响应可靠性。

weixin_42548888的博客 358

API深度集成——OpenClaw与第三方服务无缝对接(2026实战版)

本文介绍了OpenClaw系统与第三方服务的API深度集成技术,重点阐述了RESTful API的实现方案。通过一个功能完善的REST客户端类(RestClient)展示了核心功能:支持请求重试、拦截器机制、错误处理和认证管理等;同时提供了API资源管理器(ApiResourceManager)简化资源操作。这些技术实现了OpenClaw与外部系统的稳定可靠对接,为开发者构建API集成方案提供了2026年的最佳实践。

博客 1220

android性能分析之Systrace

启动 -Systrace Systrace 是 Android4.1 中新增的性能数据采样和分析工具。它可帮助开发者收集 Android 关键子系统(如 SurfaceFlinger/SystemServer/Kernel/Input/Display 等 Framework 部分关键模块、服务,View系统等)的运行信息,从而帮助开发者更直观的分析系统瓶颈,改进性能 Systrace的功能包括跟踪系统的I/O操作、内核工作队列、CPU负载以及Android各个子系统的运行状况(如surfaceflinger

zhzhangnews的博客 7020

工业视觉降本300%实战:C# + 开源YOLO如何干掉Halcon/VisionPro?

在当前制造业普遍追求“降本增效”的大背景下,工业视觉检测系统作为产线的眼睛,其成本问题日益突出。通过该方案,我们成功帮助一家电子厂将单条产线的视觉检测成本从15万降低至不足5千(主要为工控机硬件成本),降本幅度超过95%,且系统稳定性经受住了6个月连续生产的考验。:C#负责“工程化”和“业务逻辑”,YOLO负责“智能算法”,二者结合,完美覆盖了工业视觉从算法到落地的全链路。的组合,构建一套高性能、低成本、易维护的工业视觉解决方案,并彻底替代昂贵的付费库。” 这是一个典型的误区。工业相机/USB相机。

2601_94871597的博客 440

Android Systrace使用技巧之TraceOrdinal

systrace 是分析 Android 设备性能的主要工具,在PC端使用。Android设备端对应的应用层控制程序是atrace。Kernel对应使用的模块是ftrace。建议使用systrace之前,先简单学习ftrace的使用方法。

qq_23107059的博客 1532

汽车零部件产线实战:C#上位机+YOLO实现螺栓装配到位视觉检测

本项目基于C#上位机+YOLOv8实现汽车零部件产线螺栓装配到位视觉检测,全程贴合产线实际场景,从硬件选型、安装调试,到模型训练、上位机开发,再到项目联调、优化扩展,均提供手把手实操指导,代码可直接复制使用,规避了工业视觉产线检测的高频踩坑点。

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 1338

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

android性能分析之常用命令

https://blog.csdn.net/zhzhangnews/article/details/92383355 性能分析: 从AS3.0,android使用Profile来进行分析,关于Profile的使用,请参考文章: Android Profiler分析(一)概述 Android Profiler分析(二) Memory Profiler Android Profiler分析(三) CP...

weixin_41355766的博客 707

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

Systrace

Google 链接 Systrace是一个platform-provided工具,用于记录设备在短时间内的活动。 允许在系统级别上收集和检查设备上运行的所有进程的时间信息。将来自Android内核的数据(如CPU调度程序、磁盘活动和应用程序线程)结合起来生成一个HTML报告,帮助确定如何最好地提高应用程序或游戏的性能。该报告突出了它观察到的问题(如在显示动作或动画时的ui jank),并且提供了有...

n_fly的博客 605

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

代码里添加systrace跟踪(三)

无论在哪层,都需要TAG,JAVA层的TAG在Trace.java里定义: 29 public final class Trace {  30    // These tags must be kept in sync withframeworks/native/include/utils/Trace.h.  31    public static final long TRACE_TAG_

oujunli的专栏 1万+

Analyzing Display and Performance with Systrace

Analyzing Display and Performance with Systrace http://developer.android.com/tools/debugging/systrace.html 一点小原理: Systrace是对Linux Kernel中ftrace的封装。应用进程需要利用Android提供的Trace类来使用Systrace。 ATRACE_INT:用

zirconsdu的专栏 4134

【转】Android 自定义 添加systrace

android systrace

青梅煮酒的专栏 1790

Android systrace抓取工具atrace、perfetto的使用

systrace主要用来分析析能问题:应用响应速度慢、动画播放不流畅、卡顿或耗电量过高表示应用存在性能问题。共有三种方法,一是android studio、二是命令行、三是prefetto。

binktang的专栏 7604

atrace 视角剖析系统跟踪

Android Atrace 剖析: 一个跟踪范围涵盖了用户空间(App/Framewrok/native),内核空间(Kernel),设备厂商私有服务(Vendor)的系统级别跟踪工具。它不仅集成了内核ftrace的event-tracepoint静态跟踪能力,还集成了ftrace的function_graph动态跟踪能力,并支撑着perfetto,systrace等性能分析工具的底层跟踪能力

随风达的博客 3155

ATRACE_FORMAT 的使用

ATRACE_FORMAT 的使用

我的博客 220

Android T systemTrace 说明

BLASTBufferQueue

wangcheng74520的专栏 2135
上一篇: android 13 systrace/perfetto视角分析SurfaceFlinger中截图源码分析
下一篇: selinux相关学习笔记-简单selinux部分的解决
千里马学框架
博客等级 码龄6年 1万+粉丝 653原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

千里马学框架

帮助你了,就请我喝杯咖啡

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值