#define MAX_APP_LAUNCH_TIME 60
#define MAX_CONNECT_TIMEOUT_TIME 5*60
+
+int get_comm_pid(void)
+{
+ return manager.comm_pid;
+}
+
+void set_comm_pid(int pid)
+{
+ manager.comm_pid = pid;
+}
+
+void reset_comm_pid(void)
+{
+ set_comm_pid(no_comm_pid);
+}
+
uint64_t get_total_alloc_size_by_pid(pid_t pid)
{
int i;
LOGI("join recv thread %d. done\n", i);
}
}
+
+ reset_comm_pid();
}
// terminate all profiling by critical error
static int target_event_stop_handler(int index, uint64_t msg)
{
+ int cnt, comm_pid;
+
LOGI("target close, socket(%d), pid(%d) : (remaining %d target)\n",
manager.target[index].socket, manager.target[index].pid,
manager.target_count - 1);
+ comm_pid = get_comm_pid();
+ if (manager.target[index].pid == comm_pid)
+ reset_comm_pid();
+
if (index == 0) // main application
stop_replay();
setEmptyTargetSlot(index);
// all target client are closed
- if (0 == __sync_sub_and_fetch(&manager.target_count, 1)) {
+ cnt = __sync_sub_and_fetch(&manager.target_count, 1);
+ if (0 == cnt && no_comm_pid == comm_pid) {
LOGI("all targets are stopped\n");
if (stop_all() != ERR_NO)
LOGE("Stop failed\n");
typedef struct
{
+ int comm_pid;
int host_server_socket;
int target_server_socket;
int target_count;
extern __da_manager manager;
+
+enum { no_comm_pid = -1 };
+
+int get_comm_pid(void);
+void set_comm_pid(int pid);
+void reset_comm_pid(void);
+
+
uint64_t get_total_alloc_size(void);
void initialize_log(void);
int daemonLoop(void);
// initialize global variable
__da_manager manager =
{
+ .comm_pid = no_comm_pid,
.host_server_socket = -1,
.target_server_socket = -1,
.target_count = 0,