3 ** Copyright 2015, The Android Open Source Project
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
9 ** http://www.apache.org/licenses/LICENSE-2.0
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
27 #include <sys/types.h>
37 #include <android-base/file.h>
38 #include <android-base/properties.h>
39 #include <android-base/stringprintf.h>
41 #include "perfprofdcore.h"
42 #include "perfprofdutils.h"
43 #include "perf_data_converter.h"
44 #include "cpuconfig.h"
45 #include "configreader.h"
48 // Perf profiling daemon -- collects system-wide profiles using
50 // simpleperf record -a
52 // and encodes them so that they can be uploaded by a separate service.
55 //......................................................................
58 // Output file from 'perf record'.
60 #define PERF_OUTPUT "perf.data"
63 // This enum holds the results of the "should we profile" configuration check.
67 // All systems go for profile collection.
70 // The selected configuration directory doesn't exist.
71 DONT_PROFILE_MISSING_CONFIG_DIR,
73 // Destination directory does not contain the semaphore file that
74 // the perf profile uploading service creates when it determines
75 // that the user has opted "in" for usage data collection. No
76 // semaphore -> no user approval -> no profiling.
77 DONT_PROFILE_MISSING_SEMAPHORE,
79 // No perf executable present
80 DONT_PROFILE_MISSING_PERF_EXECUTABLE,
82 // We're running in the emulator, perf won't be able to do much
83 DONT_PROFILE_RUNNING_IN_EMULATOR
88 // Are we running in the emulator? If so, stub out profile collection
89 // Starts as uninitialized (-1), then set to 1 or 0 at init time.
91 static int running_in_emulator = -1;
94 // Is this a debug build ('userdebug' or 'eng')?
95 // Starts as uninitialized (-1), then set to 1 or 0 at init time.
97 static int is_debug_build = -1;
100 // Path to the perf file to convert and exit? Empty value is the default, daemon mode.
102 static std::string perf_file_to_convert = "";
105 // Random number generator seed (set at startup time).
107 static unsigned short random_seed[3];
110 // SIGHUP handler. Sending SIGHUP to the daemon can be used to break it
111 // out of a sleep() call so as to trigger a new collection (debugging)
113 static void sig_hup(int /* signum */)
115 W_ALOGW("SIGHUP received");
119 // Parse command line args. Currently supported flags:
120 // * "-c PATH" sets the path of the config file to PATH.
121 // * "-x PATH" reads PATH as a perf data file and saves it as a file in
122 // perf_profile.proto format. ".encoded" suffix is appended to PATH to form
123 // the output file path.
125 static void parse_args(int argc, char** argv)
129 for (ac = 1; ac < argc; ++ac) {
130 if (!strcmp(argv[ac], "-c")) {
132 W_ALOGE("malformed command line: -c option requires argument)");
135 ConfigReader::setConfigFilePath(argv[ac+1]);
137 } else if (!strcmp(argv[ac], "-x")) {
139 W_ALOGE("malformed command line: -x option requires argument)");
142 perf_file_to_convert = argv[ac+1];
145 W_ALOGE("malformed command line: unknown option or arg %s)", argv[ac]);
152 // Convert a CKPROFILE_RESULT to a string
154 const char *ckprofile_result_to_string(CKPROFILE_RESULT result)
157 case DO_COLLECT_PROFILE:
158 return "DO_COLLECT_PROFILE";
159 case DONT_PROFILE_MISSING_CONFIG_DIR:
160 return "missing config directory";
161 case DONT_PROFILE_MISSING_SEMAPHORE:
162 return "missing semaphore file";
163 case DONT_PROFILE_MISSING_PERF_EXECUTABLE:
164 return "missing 'perf' executable";
165 case DONT_PROFILE_RUNNING_IN_EMULATOR:
166 return "running in emulator";
167 default: return "unknown";
173 // Convert a PROFILE_RESULT to a string
175 const char *profile_result_to_string(PROFILE_RESULT result)
178 case OK_PROFILE_COLLECTION:
179 return "profile collection succeeded";
180 case ERR_FORK_FAILED:
181 return "fork() system call failed";
182 case ERR_PERF_RECORD_FAILED:
183 return "perf record returned bad exit status";
184 case ERR_PERF_ENCODE_FAILED:
185 return "failure encoding perf.data to protobuf";
186 case ERR_OPEN_ENCODED_FILE_FAILED:
187 return "failed to open encoded perf file";
188 case ERR_WRITE_ENCODED_FILE_FAILED:
189 return "write to encoded perf file failed";
190 default: return "unknown";
196 // Check to see whether we should perform a profile collection
198 static CKPROFILE_RESULT check_profiling_enabled(ConfigReader &config)
201 // Profile collection in the emulator doesn't make sense
203 assert(running_in_emulator != -1);
204 if (running_in_emulator) {
205 return DONT_PROFILE_RUNNING_IN_EMULATOR;
209 // Check for existence of semaphore file in config directory
211 if (access(config.getStringValue("config_directory").c_str(), F_OK) == -1) {
212 W_ALOGW("unable to open config directory %s: (%s)",
213 config.getStringValue("config_directory").c_str(), strerror(errno));
214 return DONT_PROFILE_MISSING_CONFIG_DIR;
218 // Check for existence of semaphore file
219 std::string semaphore_filepath = config.getStringValue("config_directory")
220 + "/" + SEMAPHORE_FILENAME;
221 if (access(semaphore_filepath.c_str(), F_OK) == -1) {
222 return DONT_PROFILE_MISSING_SEMAPHORE;
225 // Check for existence of simpleperf/perf executable
226 std::string pp = config.getStringValue("perf_path");
227 if (access(pp.c_str(), R_OK|X_OK) == -1) {
228 W_ALOGW("unable to access/execute %s", pp.c_str());
229 return DONT_PROFILE_MISSING_PERF_EXECUTABLE;
235 return DO_COLLECT_PROFILE;
240 return android::base::GetBoolProperty("sys.boot_completed", false) != true;
244 // Constructor takes a timeout (in seconds) and a child pid; If an
245 // alarm set for the specified number of seconds triggers, then a
246 // SIGKILL is sent to the child. Destructor resets alarm. Example:
248 // pid_t child_pid = ...;
249 // { AlarmHelper h(10, child_pid);
250 // ... = read_from_child(child_pid, ...);
253 // NB: this helper is not re-entrant-- avoid nested use or
254 // use by multiple threads
258 AlarmHelper(unsigned num_seconds, pid_t child)
260 struct sigaction sigact;
263 memset(&sigact, 0, sizeof(sigact));
264 sigact.sa_sigaction = handler;
265 sigaction(SIGALRM, &sigact, &oldsigact_);
273 sigaction(SIGALRM, &oldsigact_, NULL);
275 static void handler(int, siginfo_t *, void *);
278 struct sigaction oldsigact_;
282 pid_t AlarmHelper::child_;
284 void AlarmHelper::handler(int, siginfo_t *, void *)
286 W_ALOGW("SIGALRM timeout");
287 kill(child_, SIGKILL);
291 // This implementation invokes "dumpsys media.camera" and inspects the
292 // output to determine if any camera clients are active. NB: this is
293 // currently disable (via config option) until the selinux issues can
294 // be sorted out. Another possible implementation (not yet attempted)
295 // would be to use the binder to call into the native camera service
296 // via "ICameraService".
298 bool get_camera_active()
301 if (pipe2(pipefds, O_CLOEXEC) != 0) {
302 W_ALOGE("pipe2() failed (%s)", strerror(errno));
307 W_ALOGE("fork() failed (%s)", strerror(errno));
311 } else if (pid == 0) {
314 dup2(pipefds[1], fileno(stderr));
315 dup2(pipefds[1], fileno(stdout));
316 const char *argv[10];
318 argv[slot++] = "/system/bin/dumpsys";
319 argv[slot++] = "media.camera";
320 argv[slot++] = nullptr;
321 execvp(argv[0], (char * const *)argv);
322 W_ALOGE("execvp() failed (%s)", strerror(errno));
326 AlarmHelper helper(10, pid);
330 bool have_cam = false;
331 bool have_clients = true;
332 std::string dump_output;
333 bool result = android::base::ReadFdToString(pipefds[0], &dump_output);
336 std::stringstream ss(dump_output);
338 while (std::getline(ss,line,'\n')) {
339 if (line.find("Camera module API version:") !=
343 if (line.find("No camera module available") !=
345 line.find("No active camera clients yet") !=
347 have_clients = false;
352 // reap child (no zombies please)
354 TEMP_FAILURE_RETRY(waitpid(pid, &st, 0));
355 return have_cam && have_clients;
360 std::string psdir("/sys/class/power_supply");
361 DIR* dir = opendir(psdir.c_str());
363 W_ALOGE("Failed to open dir %s (%s)", psdir.c_str(), strerror(errno));
368 while ((e = readdir(dir)) != 0) {
369 if (e->d_name[0] != '.') {
370 std::string online_path = psdir + "/" + e->d_name + "/online";
371 std::string contents;
373 if (android::base::ReadFileToString(online_path.c_str(), &contents) &&
374 sscanf(contents.c_str(), "%d", &value) == 1) {
386 bool postprocess_proc_stat_contents(const std::string &pscontents,
387 long unsigned *idleticks,
388 long unsigned *remainingticks)
390 long unsigned usertime, nicetime, systime, idletime, iowaittime;
391 long unsigned irqtime, softirqtime;
393 int rc = sscanf(pscontents.c_str(), "cpu %lu %lu %lu %lu %lu %lu %lu",
394 &usertime, &nicetime, &systime, &idletime,
395 &iowaittime, &irqtime, &softirqtime);
399 *idleticks = idletime;
400 *remainingticks = usertime + nicetime + systime + iowaittime + irqtime + softirqtime;
404 unsigned collect_cpu_utilization()
406 std::string contents;
407 long unsigned idle[2];
408 long unsigned busy[2];
409 for (unsigned iter = 0; iter < 2; ++iter) {
410 if (!android::base::ReadFileToString("/proc/stat", &contents)) {
413 if (!postprocess_proc_stat_contents(contents, &idle[iter], &busy[iter])) {
420 long unsigned total_delta = (idle[1] + busy[1]) - (idle[0] + busy[0]);
421 long unsigned busy_delta = busy[1] - busy[0];
422 return busy_delta * 100 / total_delta;
425 static void annotate_encoded_perf_profile(wireless_android_play_playlog::AndroidPerfProfile *profile,
426 const ConfigReader &config,
427 unsigned cpu_utilization)
430 // Incorporate cpu utilization (collected prior to perf run)
432 if (config.getUnsignedValue("collect_cpu_utilization")) {
433 profile->set_cpu_utilization(cpu_utilization);
437 // Load average as reported by the kernel
441 if (android::base::ReadFileToString("/proc/loadavg", &load) &&
442 sscanf(load.c_str(), "%lf", &fload) == 1) {
443 int iload = static_cast<int>(fload * 100.0);
444 profile->set_sys_load_average(iload);
446 W_ALOGE("Failed to read or scan /proc/loadavg (%s)", strerror(errno));
450 // Device still booting? Camera in use? Plugged into charger?
452 bool is_booting = get_booting();
453 if (config.getUnsignedValue("collect_booting")) {
454 profile->set_booting(is_booting);
456 if (config.getUnsignedValue("collect_camera_active")) {
457 profile->set_camera_active(is_booting ? false : get_camera_active());
459 if (config.getUnsignedValue("collect_charging_state")) {
460 profile->set_on_charger(get_charging());
464 // Examine the contents of wake_unlock to determine whether the
465 // device display is on or off. NB: is this really the only way to
466 // determine this info?
469 if (android::base::ReadFileToString("/sys/power/wake_unlock", &disp)) {
470 bool ison = (strstr(disp.c_str(), "PowerManagerService.Display") == 0);
471 profile->set_display_on(ison);
473 W_ALOGE("Failed to read /sys/power/wake_unlock (%s)", strerror(errno));
477 inline char* string_as_array(std::string* str) {
478 return str->empty() ? NULL : &*str->begin();
481 PROFILE_RESULT encode_to_proto(const std::string &data_file_path,
482 const char *encoded_file_path,
483 const ConfigReader &config,
484 unsigned cpu_utilization)
487 // Open and read perf.data file
489 const wireless_android_play_playlog::AndroidPerfProfile &encodedProfile =
490 wireless_android_logging_awp::RawPerfDataToAndroidPerfProfile(data_file_path);
493 // Issue error if no samples
495 if (encodedProfile.programs().size() == 0) {
496 return ERR_PERF_ENCODE_FAILED;
499 // All of the info in 'encodedProfile' is derived from the perf.data file;
500 // here we tack display status, cpu utilization, system load, etc.
501 wireless_android_play_playlog::AndroidPerfProfile &prof =
502 const_cast<wireless_android_play_playlog::AndroidPerfProfile&>
504 annotate_encoded_perf_profile(&prof, config, cpu_utilization);
507 // Serialize protobuf to array
509 int size = encodedProfile.ByteSize();
512 ::google::protobuf::uint8* dtarget =
513 reinterpret_cast<::google::protobuf::uint8*>(string_as_array(&data));
514 encodedProfile.SerializeWithCachedSizesToArray(dtarget);
517 // Open file and write encoded data to it
519 FILE *fp = fopen(encoded_file_path, "w");
521 return ERR_OPEN_ENCODED_FILE_FAILED;
524 if (fwrite(dtarget, fsiz, 1, fp) != 1) {
526 return ERR_WRITE_ENCODED_FILE_FAILED;
529 chmod(encoded_file_path, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
531 return OK_PROFILE_COLLECTION;
535 // Invoke "perf record". Return value is OK_PROFILE_COLLECTION for
536 // success, or some other error code if something went wrong.
538 static PROFILE_RESULT invoke_perf(const std::string &perf_path,
539 unsigned sampling_period,
540 const char *stack_profile_opt,
542 const std::string &data_file_path,
543 const std::string &perf_stderr_path)
548 return ERR_FORK_FAILED;
554 // Open file to receive stderr/stdout from perf
555 FILE *efp = fopen(perf_stderr_path.c_str(), "w");
557 dup2(fileno(efp), STDERR_FILENO);
558 dup2(fileno(efp), STDOUT_FILENO);
560 W_ALOGW("unable to open %s for writing", perf_stderr_path.c_str());
563 // marshall arguments
564 constexpr unsigned max_args = 13;
565 const char *argv[max_args];
567 argv[slot++] = perf_path.c_str();
568 argv[slot++] = "record";
572 argv[slot++] = data_file_path.c_str();
576 std::string p_str = android::base::StringPrintf("%u", sampling_period);
577 argv[slot++] = p_str.c_str();
580 if (stack_profile_opt)
581 argv[slot++] = stack_profile_opt;
583 // system wide profiling
586 // no need for kernel symbols
587 argv[slot++] = "--no-dump-kernel-symbols";
590 argv[slot++] = "/system/bin/sleep";
591 std::string d_str = android::base::StringPrintf("%u", duration);
592 argv[slot++] = d_str.c_str();
595 argv[slot++] = nullptr;
596 assert(slot < max_args);
598 // record the final command line in the error output file for
599 // posterity/debugging purposes
600 fprintf(stderr, "perf invocation (pid=%d):\n", getpid());
601 for (unsigned i = 0; argv[i] != nullptr; ++i) {
602 fprintf(stderr, "%s%s", i ? " " : "", argv[i]);
604 fprintf(stderr, "\n");
607 execvp(argv[0], (char * const *)argv);
608 fprintf(stderr, "exec failed: %s\n", strerror(errno));
614 pid_t reaped = TEMP_FAILURE_RETRY(waitpid(pid, &st, 0));
617 W_ALOGW("waitpid failed: %s", strerror(errno));
618 } else if (WIFSIGNALED(st)) {
619 W_ALOGW("perf killed by signal %d", WTERMSIG(st));
620 } else if (WEXITSTATUS(st) != 0) {
621 W_ALOGW("perf bad exit status %d", WEXITSTATUS(st));
623 return OK_PROFILE_COLLECTION;
627 return ERR_PERF_RECORD_FAILED;
631 // Remove all files in the destination directory during initialization
633 static void cleanup_destination_dir(const ConfigReader &config)
635 std::string dest_dir = config.getStringValue("destination_directory");
636 DIR* dir = opendir(dest_dir.c_str());
639 while ((e = readdir(dir)) != 0) {
640 if (e->d_name[0] != '.') {
641 std::string file_path = dest_dir + "/" + e->d_name;
642 remove(file_path.c_str());
647 W_ALOGW("unable to open destination dir %s for cleanup",
653 // Post-processes after profile is collected and converted to protobuf.
654 // * GMS core stores processed file sequence numbers in
655 // /data/data/com.google.android.gms/files/perfprofd_processed.txt
656 // * Update /data/misc/perfprofd/perfprofd_produced.txt to remove the sequence
657 // numbers that have been processed and append the current seq number
658 // Returns true if the current_seq should increment.
660 static bool post_process(const ConfigReader &config, int current_seq)
662 std::string dest_dir = config.getStringValue("destination_directory");
663 std::string processed_file_path =
664 config.getStringValue("config_directory") + "/" + PROCESSED_FILENAME;
665 std::string produced_file_path = dest_dir + "/" + PRODUCED_FILENAME;
668 std::set<int> processed;
669 FILE *fp = fopen(processed_file_path.c_str(), "r");
672 while(fscanf(fp, "%d\n", &seq) > 0) {
673 if (remove(android::base::StringPrintf(
674 "%s/perf.data.encoded.%d", dest_dir.c_str(),seq).c_str()) == 0) {
675 processed.insert(seq);
681 std::set<int> produced;
682 fp = fopen(produced_file_path.c_str(), "r");
685 while(fscanf(fp, "%d\n", &seq) > 0) {
686 if (processed.find(seq) == processed.end()) {
687 produced.insert(seq);
693 unsigned maxLive = config.getUnsignedValue("max_unprocessed_profiles");
694 if (produced.size() >= maxLive) {
698 produced.insert(current_seq);
699 fp = fopen(produced_file_path.c_str(), "w");
701 W_ALOGW("Cannot write %s", produced_file_path.c_str());
704 for (std::set<int>::const_iterator iter = produced.begin();
705 iter != produced.end(); ++iter) {
706 fprintf(fp, "%d\n", *iter);
709 chmod(produced_file_path.c_str(),
710 S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
715 // Collect a perf profile. Steps for this operation are:
716 // - kick off 'perf record'
717 // - read perf.data, convert to protocol buf
719 static PROFILE_RESULT collect_profile(const ConfigReader &config, int seq)
722 // Collect cpu utilization if enabled
724 unsigned cpu_utilization = 0;
725 if (config.getUnsignedValue("collect_cpu_utilization")) {
726 cpu_utilization = collect_cpu_utilization();
730 // Form perf.data file name, perf error output file name
732 std::string destdir = config.getStringValue("destination_directory");
733 std::string data_file_path(destdir);
734 data_file_path += "/";
735 data_file_path += PERF_OUTPUT;
736 std::string perf_stderr_path(destdir);
737 perf_stderr_path += "/perferr.txt";
740 // Remove any existing perf.data file -- if we don't do this, perf
741 // will rename the old file and we'll have extra cruft lying around.
744 if (stat(data_file_path.c_str(), &statb) == 0) { // if file exists...
745 if (unlink(data_file_path.c_str())) { // then try to remove
746 W_ALOGW("unable to unlink previous perf.data file");
751 // The "mpdecision" daemon can cause problems for profile
752 // collection: if it decides to online a CPU partway through the
753 // 'perf record' run, the activity on that CPU will be invisible to
754 // perf, and if it offlines a CPU during the recording this can
755 // sometimes leave the PMU in an unusable state (dmesg errors of the
756 // form "perfevents: unable to request IRQXXX for ..."). To avoid
757 // these issues, if "mpdecision" is running the helper below will
758 // stop the service and then online all available CPUs. The object
759 // destructor (invoked when this routine terminates) will then
760 // restart the service again when needed.
762 unsigned duration = config.getUnsignedValue("sample_duration");
763 unsigned hardwire = config.getUnsignedValue("hardwire_cpus");
764 unsigned max_duration = config.getUnsignedValue("hardwire_cpus_max_duration");
765 bool take_action = (hardwire && duration <= max_duration);
766 HardwireCpuHelper helper(take_action);
771 const char *stack_profile_opt =
772 (config.getUnsignedValue("stack_profile") != 0 ? "-g" : nullptr);
773 std::string perf_path = config.getStringValue("perf_path");
774 unsigned period = config.getUnsignedValue("sampling_period");
776 PROFILE_RESULT ret = invoke_perf(perf_path.c_str(),
782 if (ret != OK_PROFILE_COLLECTION) {
787 // Read the resulting perf.data file, encode into protocol buffer, then write
788 // the result to the file perf.data.encoded
790 std::string path = android::base::StringPrintf(
791 "%s.encoded.%d", data_file_path.c_str(), seq);
792 return encode_to_proto(data_file_path, path.c_str(), config, cpu_utilization);
796 // Assuming that we want to collect a profile every N seconds,
797 // randomly partition N into two sub-intervals.
799 static void determine_before_after(unsigned &sleep_before_collect,
800 unsigned &sleep_after_collect,
801 unsigned collection_interval)
803 double frac = erand48(random_seed);
804 sleep_before_collect = (unsigned) (((double)collection_interval) * frac);
805 assert(sleep_before_collect <= collection_interval);
806 sleep_after_collect = collection_interval - sleep_before_collect;
810 // Set random number generator seed
812 static void set_seed(ConfigReader &config)
815 unsigned use_fixed_seed = config.getUnsignedValue("use_fixed_seed");
816 if (use_fixed_seed) {
818 // Use fixed user-specified seed
820 seed = use_fixed_seed;
827 W_ALOGI("random seed set to %u", seed);
828 // Distribute the 32-bit seed into the three 16-bit array
829 // elements. The specific values being written do not especially
830 // matter as long as we are setting them to something based on the seed.
831 random_seed[0] = seed & 0xffff;
832 random_seed[1] = (seed >> 16);
833 random_seed[2] = (random_seed[0] ^ random_seed[1]);
839 static void init(ConfigReader &config)
841 if (!config.readFile()) {
842 W_ALOGE("unable to open configuration file %s",
843 config.getConfigFilePath());
846 // Children of init inherit an artificially low OOM score -- this is not
847 // desirable for perfprofd (its OOM score should be on par with
848 // other user processes).
849 std::stringstream oomscore_path;
850 oomscore_path << "/proc/" << getpid() << "/oom_score_adj";
851 if (!android::base::WriteStringToFile("0", oomscore_path.str())) {
852 W_ALOGE("unable to write to %s", oomscore_path.str().c_str());
856 cleanup_destination_dir(config);
858 running_in_emulator = android::base::GetBoolProperty("ro.kernel.qemu", false);
859 is_debug_build = android::base::GetBoolProperty("ro.debuggable", false);
861 signal(SIGHUP, sig_hup);
866 // 1. parse cmd line args
867 // 2. read config file
870 // perform a profile collection
873 int perfprofd_main(int argc, char** argv)
877 W_ALOGI("starting Android Wide Profiling daemon");
879 parse_args(argc, argv);
882 if (!perf_file_to_convert.empty()) {
883 std::string encoded_path = perf_file_to_convert + ".encoded";
884 encode_to_proto(perf_file_to_convert, encoded_path.c_str(), config, 0);
888 // Early exit if we're not supposed to run on this build flavor
889 if (is_debug_build != 1 &&
890 config.getUnsignedValue("only_debug_build") == 1) {
891 W_ALOGI("early exit due to inappropriate build type");
895 unsigned iterations = 0;
897 while(config.getUnsignedValue("main_loop_iterations") == 0 ||
898 iterations < config.getUnsignedValue("main_loop_iterations")) {
900 // Figure out where in the collection interval we're going to actually
902 unsigned sleep_before_collect = 0;
903 unsigned sleep_after_collect = 0;
904 determine_before_after(sleep_before_collect, sleep_after_collect,
905 config.getUnsignedValue("collection_interval"));
906 perfprofd_sleep(sleep_before_collect);
908 // Reread config file -- the uploader may have rewritten it as a result
909 // of a gservices change
912 // Check for profiling enabled...
913 CKPROFILE_RESULT ckresult = check_profiling_enabled(config);
914 if (ckresult != DO_COLLECT_PROFILE) {
915 W_ALOGI("profile collection skipped (%s)",
916 ckprofile_result_to_string(ckresult));
918 // Kick off the profiling run...
919 W_ALOGI("initiating profile collection");
920 PROFILE_RESULT result = collect_profile(config, seq);
921 if (result != OK_PROFILE_COLLECTION) {
922 W_ALOGI("profile collection failed (%s)",
923 profile_result_to_string(result));
925 if (post_process(config, seq)) {
928 W_ALOGI("profile collection complete");
931 perfprofd_sleep(sleep_after_collect);
935 W_ALOGI("finishing Android Wide Profiling daemon");