コード例 #1
0
/// The call update active tasks information.
int task_info_manager_update()
{
    int ret;

    host_info_record.seq++;
    host_info_record.cpu_user = 0;
	host_info_record.cpu_kernel = 0;

     ret = read_host_info();
     if (ret != 0)
     {
          return ret;
     }
    
     ret = read_tasks_table();
     if (ret != 0)
     {
          return ret;
     }
    
     ret = remove_killed_process();
     if (ret != 0)
     {
          return ret;
     }
    
     return 0;
}
コード例 #2
0
int msg_distribution::read_all_host_lists_info(const string &host_info_dir)
{
	if (!host_info_dir.empty())
	{
		fsys::path tmp_dir(host_info_dir);
		if (fsys::exists(tmp_dir))
		{
			boost_error_code ec;
			fsys::directory_iterator search_dir(tmp_dir, ec);
			for (auto item : search_dir)
			{
				auto file = item.path();
				if (!fsys::is_directory(file) && file.extension().string() == ".xml")
				{
					auto file_name = file.string();
					read_host_info(file_name);
				}
			}
		}
	}
	if (0 < s_host_listen_lists.size())
	{
		return s_host_listen_lists.size();
	}
	else
	{
		return -1;
	}
}