Commit 9033c01a authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

sorry, forgot these...


Former-commit-id: de34e33cd14afd74276aeb4d84522cc8e4c0c2fa
parent fd335842
/*******************************************************************************
* This file is part of SWIFT.
* Coypright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
/* Config parameters. */
#include "../config.h"
/* Local headers. */
#include "cycle.h"
#include "timers.h"
/* The timers. */
ticks timers[ timer_count ];
/**
* @brief Re-set the timers.
*
* @param mask A bitmask of the timers to re-set.
*
* To reset all timers, use the mask #timer_mask_all.
*/
void timers_reset ( unsigned int mask ) {
int k;
/* Loop over the timers and set the masked ones to zero. */
for ( k = 0 ; k < timer_count ; k++ )
if ( mask & ( 1 << k ) )
timers[ k ] = 0;
}
/*******************************************************************************
* This file is part of SWIFT.
* Coypright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
/* The timers themselves. */
enum {
timer_none = 0,
timer_prepare,
timer_dosort,
timer_doself_density,
timer_doself_force,
timer_dopair_density,
timer_dopair_force,
timer_dosub_density,
timer_dosub_force,
timer_dopair_subset,
timer_doghost,
timer_getpair,
timer_steal,
timer_stalled,
timer_step,
timer_count,
};
/* The timers. */
extern ticks timers[ timer_count ];
/* Mask for all timers. */
#define timers_mask_all ( (1 << timer_count) - 1 )
/* Define the timer macros. */
#ifdef TIMER_VERBOSE
#ifndef TIMER
#define TIMER
#endif
#endif
#ifdef TIMER
#define TIMER_TIC ticks tic = getticks();
#define TIMER_TOC(t) timers_toc( t , tic )
#define TIMER_TIC2 ticks tic2 = getticks();
#define TIMER_TOC2(t) timers_toc( t , tic2 )
#ifndef INLINE
# if __GNUC__ && !__GNUC_STDC_INLINE__
# define INLINE extern inline
# else
# define INLINE inline
# endif
#endif
INLINE static ticks timers_toc ( int t , ticks tic ) {
ticks d = (getticks() - tic);
__sync_add_and_fetch( &timers[t] , d );
return d;
}
#else
#define TIMER_TIC
#define TIMER_TOC(t)
#define TIMER_TIC2
#define TIMER_TOC2(t)
#endif
/* Function prototypes. */
void timers_reset ( unsigned int mask );
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment