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

Commit d42ac617 authored by Yi Kong's avatar Yi Kong
Browse files

profcollect: collect intilization code behavior for camera open events

First several frames may have a different code behavior for camera code.
Allocate a small percentage of traces to capture those behavior.

Test: presubmit
Change-Id: Icf343b23ee51dfb83798ecc4be9a3fb5a219412b
parent b983c5bc
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -398,14 +398,17 @@ public final class ProfcollectForwardingService extends SystemService {
                if (randomNum >= traceFrequency) {
                if (randomNum >= traceFrequency) {
                    return;
                    return;
                }
                }
                // Wait for 1s before starting tracing.
                // For a small percentage a traces, we collect the initialization behavior.
                boolean traceInitialization = ThreadLocalRandom.current().nextInt(10) < 1;
                int traceDelay = traceInitialization ? 0 : 1000;
                String traceTag = traceInitialization ? "camera_init" : "camera";
                BackgroundThread.get().getThreadHandler().postDelayed(() -> {
                BackgroundThread.get().getThreadHandler().postDelayed(() -> {
                    try {
                    try {
                        mIProfcollect.trace_once("camera");
                        mIProfcollect.trace_once(traceTag);
                    } catch (RemoteException e) {
                    } catch (RemoteException e) {
                        Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
                        Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
                    }
                    }
                }, 1000);
                }, traceDelay);
            }
            }
        }, null);
        }, null);
    }
    }