Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fabec0c5 authored by Pablo Gamito's avatar Pablo Gamito Committed by Android (Google) Code Review
Browse files

Merge "Remove slow debug messages" into main

parents e5da1ef7 02834cf5
Loading
Loading
Loading
Loading
+0 −37
Original line number Diff line number Diff line
@@ -235,9 +235,7 @@ PerfettoDataSource::~PerfettoDataSource() {

jlong nativeCreate(JNIEnv* env, jclass clazz, jobject javaDataSource, jstring name) {
    const char* nativeString = env->GetStringUTFChars(name, 0);
    ALOG(LOG_DEBUG, LOG_TAG, "nativeCreate(%p, %s)", javaDataSource, nativeString);
    PerfettoDataSource* dataSource = new PerfettoDataSource(env, javaDataSource, nativeString);
    ALOG(LOG_DEBUG, LOG_TAG, "\tdatasource* = %p", dataSource);
    env->ReleaseStringUTFChars(name, nativeString);

    dataSource->incStrong((void*)nativeCreate);
@@ -246,13 +244,11 @@ jlong nativeCreate(JNIEnv* env, jclass clazz, jobject javaDataSource, jstring na
}

void nativeDestroy(void* ptr) {
    ALOG(LOG_DEBUG, LOG_TAG, "nativeDestroy(%p)", ptr);
    PerfettoDataSource* dataSource = reinterpret_cast<PerfettoDataSource*>(ptr);
    dataSource->decStrong((void*)nativeCreate);
}

static jlong nativeGetFinalizer(JNIEnv* /* env */, jclass /* clazz */) {
    ALOG(LOG_DEBUG, LOG_TAG, "nativeGetFinalizer()");
    return static_cast<jlong>(reinterpret_cast<uintptr_t>(&nativeDestroy));
}

@@ -263,14 +259,12 @@ void nativeFlush(JNIEnv* env, jclass clazz, jlong ds_ptr, jobjectArray packets)
}

void nativeFlushAll(JNIEnv* env, jclass clazz, jlong ptr) {
    ALOG(LOG_DEBUG, LOG_TAG, "nativeFlushAll(%p)", (void*)ptr);
    sp<PerfettoDataSource> datasource = reinterpret_cast<PerfettoDataSource*>(ptr);
    datasource->flushAll();
}

void nativeRegisterDataSource(JNIEnv* env, jclass clazz, jlong datasource_ptr,
                              int buffer_exhausted_policy) {
    ALOG(LOG_DEBUG, LOG_TAG, "nativeRegisterDataSource(%p)", (void*)datasource_ptr);
    sp<PerfettoDataSource> datasource = reinterpret_cast<PerfettoDataSource*>(datasource_ptr);

    struct PerfettoDsParams params = PerfettoDsParamsDefault();
@@ -292,10 +286,6 @@ void nativeRegisterDataSource(JNIEnv* env, jclass clazz, jlong datasource_ptr,

        auto* datasource_instance =
                new PerfettoDataSourceInstance(env, java_data_source_instance.get(), inst_id);

        ALOG(LOG_DEBUG, LOG_TAG, "on_setup_cb ds=%p, ds_instance=%p", datasource,
             datasource_instance);

        return static_cast<void*>(datasource_instance);
    };

@@ -308,9 +298,6 @@ void nativeRegisterDataSource(JNIEnv* env, jclass clazz, jlong datasource_ptr,
        jobject java_tls_state = datasource->createTlsStateGlobalRef(env, inst_id);

        auto* tls_state = new TlsState(java_tls_state);

        ALOG(LOG_DEBUG, LOG_TAG, "on_create_tls_cb ds=%p, tsl_state=%p", datasource, tls_state);

        return static_cast<void*>(tls_state);
    };

@@ -319,8 +306,6 @@ void nativeRegisterDataSource(JNIEnv* env, jclass clazz, jlong datasource_ptr,

        TlsState* tls_state = reinterpret_cast<TlsState*>(ptr);

        ALOG(LOG_DEBUG, LOG_TAG, "on_delete_tls_cb %p", tls_state);

        env->DeleteGlobalRef(tls_state->jobj);
        delete tls_state;
    };
@@ -333,9 +318,6 @@ void nativeRegisterDataSource(JNIEnv* env, jclass clazz, jlong datasource_ptr,
        jobject java_incr_state = datasource->createIncrementalStateGlobalRef(env, inst_id);

        auto* incr_state = new IncrementalState(java_incr_state);

        ALOG(LOG_DEBUG, LOG_TAG, "on_create_incr_cb ds=%p, incr_state=%p", datasource, incr_state);

        return static_cast<void*>(incr_state);
    };

@@ -344,8 +326,6 @@ void nativeRegisterDataSource(JNIEnv* env, jclass clazz, jlong datasource_ptr,

        IncrementalState* incr_state = reinterpret_cast<IncrementalState*>(ptr);

        ALOG(LOG_DEBUG, LOG_TAG, "on_delete_incr_cb incr_state=%p", incr_state);

        env->DeleteGlobalRef(incr_state->jobj);
        delete incr_state;
    };
@@ -355,9 +335,6 @@ void nativeRegisterDataSource(JNIEnv* env, jclass clazz, jlong datasource_ptr,
        JNIEnv* env = GetOrAttachJNIEnvironment(gVm, JNI_VERSION_1_6);

        auto* datasource_instance = static_cast<PerfettoDataSourceInstance*>(inst_ctx);

        ALOG(LOG_DEBUG, LOG_TAG, "on_start_cb ds_instance=%p", datasource_instance);

        datasource_instance->onStart(env);
    };

@@ -366,9 +343,6 @@ void nativeRegisterDataSource(JNIEnv* env, jclass clazz, jlong datasource_ptr,
        JNIEnv* env = GetOrAttachJNIEnvironment(gVm, JNI_VERSION_1_6);

        auto* datasource_instance = static_cast<PerfettoDataSourceInstance*>(inst_ctx);

        ALOG(LOG_DEBUG, LOG_TAG, "on_flush_cb ds_instance=%p", datasource_instance);

        datasource_instance->onFlush(env);
    };

@@ -377,9 +351,6 @@ void nativeRegisterDataSource(JNIEnv* env, jclass clazz, jlong datasource_ptr,
        JNIEnv* env = GetOrAttachJNIEnvironment(gVm, JNI_VERSION_1_6);

        auto* datasource_instance = static_cast<PerfettoDataSourceInstance*>(inst_ctx);

        ALOG(LOG_DEBUG, LOG_TAG, "on_stop_cb ds_instance=%p", datasource_instance);

        datasource_instance->onStop(env);
    };

@@ -387,8 +358,6 @@ void nativeRegisterDataSource(JNIEnv* env, jclass clazz, jlong datasource_ptr,
                              void* inst_ctx) -> void {
        auto* datasource_instance = static_cast<PerfettoDataSourceInstance*>(inst_ctx);

        ALOG(LOG_DEBUG, LOG_TAG, "on_destroy_cb ds_instance=%p", datasource_instance);

        delete datasource_instance;
    };

@@ -397,8 +366,6 @@ void nativeRegisterDataSource(JNIEnv* env, jclass clazz, jlong datasource_ptr,

jobject nativeGetPerfettoInstanceLocked(JNIEnv* /* env */, jclass /* clazz */, jlong dataSourcePtr,
                                        PerfettoDsInstanceIndex instance_idx) {
    ALOG(LOG_DEBUG, LOG_TAG, "nativeGetPerfettoInstanceLocked ds=%p, idx=%d", (void*)dataSourcePtr,
         instance_idx);
    sp<PerfettoDataSource> datasource = reinterpret_cast<PerfettoDataSource*>(dataSourcePtr);
    auto* datasource_instance = static_cast<PerfettoDataSourceInstance*>(
            PerfettoDsImplGetInstanceLocked(datasource->dataSource.impl, instance_idx));
@@ -410,15 +377,11 @@ jobject nativeGetPerfettoInstanceLocked(JNIEnv* /* env */, jclass /* clazz */, j
        return nullptr;
    }

    ALOG(LOG_DEBUG, LOG_TAG, "\tnativeGetPerfettoInstanceLocked got lock ds=%p, idx=%d",
         (void*)dataSourcePtr, instance_idx);
    return datasource_instance->GetJavaDataSourceInstance();
}

void nativeReleasePerfettoInstanceLocked(JNIEnv* /* env */, jclass /* clazz */, jlong dataSourcePtr,
                                         PerfettoDsInstanceIndex instance_idx) {
    ALOG(LOG_DEBUG, LOG_TAG, "nativeReleasePerfettoInstanceLocked got lock ds=%p, idx=%d",
         (void*)dataSourcePtr, instance_idx);
    sp<PerfettoDataSource> datasource = reinterpret_cast<PerfettoDataSource*>(dataSourcePtr);
    PerfettoDsImplReleaseInstanceLocked(datasource->dataSource.impl, instance_idx);
}