1%%% 2%%% Copyright 2012 © nicolas niclausse 3%%% 4%%% Author : Nicolas Niclausse <nicolas@niclux.org> 5%%% Created: 22 août 2012 by Nicolas Niclausse <nicolas@niclux.org> 6%%% 7%%% This program is free software; you can redistribute it and/or modify 8%%% it under the terms of the GNU General Public License as published by 9%%% the Free Software Foundation; either version 2 of the License, or 10%%% (at your option) any later version. 11%%% 12%%% This program is distributed in the hope that it will be useful, 13%%% but WITHOUT ANY WARRANTY; without even the implied warranty of 14%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15%%% GNU General Public License for more details. 16%%% 17%%% You should have received a copy of the GNU General Public License 18%%% along with this program; if not, write to the Free Software 19%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20%%% 21 22-vc('$Id: ts_macros.hrl,v 0.0 2012/08/22 09:07:50 nniclaus Exp $ '). 23-author('nniclaus@sophia.inria.fr'). 24 25-ifndef(new_time_api). 26-define(NOW, erlang:now()). 27-define(TIMESTAMP, erlang:now()). 28-else. 29-define(NOW, erlang:monotonic_time()). 30-define(TIMESTAMP, erlang:timestamp()). 31-endif. 32 33-define(CRLF, "\r\n"). 34-define(CR,13). 35-define(LF,10). 36 37%% retry sending message after this timeout (in microsec.) 38-define(config(Var), ts_utils:get_val(Var)). 39 40%% errors messages 41 42-define(LOGF(Msg, Args, Level), 43 ts_utils:debug(?MODULE, Msg, Args, Level)). 44-define(LOG(Msg, Level), 45 ts_utils:debug(?MODULE, Msg, Level)). 46 47%% Debug messages can be completely disabled if DEBUG is not defined 48-ifdef(DEBUG). 49 -define(TRACE, [{debug, [trace]}]). 50 -define(DebugF(Msg, Args), 51 ts_utils:debug(?MODULE, Msg, Args, ?DEB)). 52 -define(Debug(Msg), 53 ts_utils:debug(?MODULE, Msg, ?DEB)). 54-else. 55 -define(TRACE, []). 56 -define(DebugF(Msg, Args), ok). 57 -define(Debug(Msg), ok). 58-endif. 59 60-define(EMERG, 0). % The system is unusable. 61-define(ALERT, 1). % Action should be taken immediately to address the problem. 62-define(CRIT, 2). % A critical condition has occurred. 63-define(ERR, 3). % An error has occurred. 64-define(WARN, 4). % A significant event that may require attention has occurred. 65-define(NOTICE, 5).% An event that does not affect system operation has occurred. 66-define(INFO, 6). % An normal operation has occurred. 67-define(DEB, 7). % Debugging info 68 69-define(TIMEOUT_PARALLEL_SPAWN, 60000). 70-define(MAX_PHASE_EXCEED_PERCENT, 20). 71-define(MAX_PHASE_EXCEED_NUSERS, 10). 72 73-define(CACHE_DUMP_STATS_INTERVAL, 500). % in milliseconds 74 75-define(restart_sleep, 2000). 76-define(infinity_timeout, 15000). 77-define(config_timeout, 60000). 78-define(check_noclient_timeout, 60000). 79-define(fast_check_noclient_timeout, 5000). 80-define(retries, 4). 81 82 83