|
@@ -409,6 +409,28 @@ static struct perf_evsel *perf_evsel__reset_weak_group(struct perf_evsel *evsel)
|
|
|
return leader;
|
|
|
}
|
|
|
|
|
|
+static bool is_target_alive(struct target *_target,
|
|
|
+ struct thread_map *threads)
|
|
|
+{
|
|
|
+ struct stat st;
|
|
|
+ int i;
|
|
|
+
|
|
|
+ if (!target__has_task(_target))
|
|
|
+ return true;
|
|
|
+
|
|
|
+ for (i = 0; i < threads->nr; i++) {
|
|
|
+ char path[PATH_MAX];
|
|
|
+
|
|
|
+ scnprintf(path, PATH_MAX, "%s/%d", procfs__mountpoint(),
|
|
|
+ threads->map[i].pid);
|
|
|
+
|
|
|
+ if (!stat(path, &st))
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
static int __run_perf_stat(int argc, const char **argv, int run_idx)
|
|
|
{
|
|
|
int interval = stat_config.interval;
|
|
@@ -579,6 +601,8 @@ try_again:
|
|
|
enable_counters();
|
|
|
while (!done) {
|
|
|
nanosleep(&ts, NULL);
|
|
|
+ if (!is_target_alive(&target, evsel_list->threads))
|
|
|
+ break;
|
|
|
if (timeout)
|
|
|
break;
|
|
|
if (interval) {
|