1212 *                         All rights reserved. 
1313 * Copyright (c) 2015      Research Organization for Information Science 
1414 *                         and Technology (RIST). All rights reserved. 
15-  * Copyright (c) 2015-2016  Los Alamos National Security, LLC. All rights 
15+  * Copyright (c) 2015-2017  Los Alamos National Security, LLC. All rights 
1616 *                         reserved. 
1717 * Copyright (c) 2015 Cisco Systems, Inc.  All rights reserved. 
1818 * Copyright (c) 2016 Broadcom Limited. All rights reserved. 
@@ -155,6 +155,10 @@ static int opal_timer_linux_find_freq(void)
155155
156156    fclose (fp );
157157
158+     /* convert the timer frequency to MHz to avoid an extra operation when 
159+      * converting from cycles to usec */ 
160+     opal_timer_linux_freq  /= 1000000 ;
161+ 
158162    return  OPAL_SUCCESS ;
159163}
160164
@@ -166,7 +170,7 @@ int opal_timer_linux_open(void)
166170#if  OPAL_HAVE_CLOCK_GETTIME  &&  (0  ==  OPAL_TIMER_MONOTONIC )
167171        struct  timespec  res ;
168172        if ( 0  ==  clock_getres (CLOCK_MONOTONIC , & res )) {
169-             opal_timer_linux_freq  =  1.e9  ;
173+             opal_timer_linux_freq  =  1.e3  ;
170174            opal_timer_base_get_cycles  =  opal_timer_base_get_cycles_clock_gettime ;
171175            opal_timer_base_get_usec  =  opal_timer_base_get_usec_clock_gettime ;
172176            return  ret ;
@@ -215,16 +219,16 @@ opal_timer_t opal_timer_base_get_cycles_sys_timer(void)
215219opal_timer_t  opal_timer_base_get_usec_sys_timer (void )
216220{
217221#if  OPAL_HAVE_SYS_TIMER_GET_CYCLES 
218-     /* freq is in Hz , so this gives usec */ 
219-     return  opal_sys_timer_get_cycles () *   1000000    / opal_timer_linux_freq ;
222+     /* freq is in MHz , so this gives usec */ 
223+     return  opal_sys_timer_get_cycles ()  / opal_timer_linux_freq ;
220224#else 
221225    return  0 ;
222226#endif 
223227}
224228
225229opal_timer_t  opal_timer_base_get_freq (void )
226230{
227-     return  opal_timer_linux_freq ;
231+     return  opal_timer_linux_freq   *   1000000 ;
228232}
229233
230234
0 commit comments