diff mbox

[API,NEXT,v6,04/14] api: sysinfo: move CPU Hz API to cpu.h

Message ID 1442495411-12362-5-git-send-email-hongbo.zhang@freescale.com
State New
Headers show

Commit Message

hongbo.zhang@freescale.com Sept. 17, 2015, 1:10 p.m. UTC
From: Hongbo Zhang <hongbo.zhang@linaro.org>

The legacy odp_sys_cpu_hz() is moved to cpu.h then accordingly renamed
to odp_cpu_hz(), and all the calling functions are also updated.

Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
---
 example/classifier/odp_classifier.c                 | 2 +-
 example/generator/odp_generator.c                   | 2 +-
 example/ipsec/odp_ipsec.c                           | 2 +-
 example/packet/odp_pktio.c                          | 2 +-
 example/timer/odp_timer_test.c                      | 4 ++--
 include/odp/api/cpu.h                               | 9 +++++++++
 include/odp/api/system_info.h                       | 7 -------
 platform/linux-generic/arch/linux/odp_time_cycles.c | 2 +-
 platform/linux-generic/odp_system_info.c            | 2 +-
 platform/linux-generic/odp_time.c                   | 4 ++--
 test/api_test/odp_common.c                          | 2 +-
 test/performance/odp_atomic.c                       | 2 +-
 test/performance/odp_l2fwd.c                        | 2 +-
 test/performance/odp_scheduling.c                   | 2 +-
 test/validation/system/system.c                     | 6 +++---
 test/validation/system/system.h                     | 2 +-
 16 files changed, 27 insertions(+), 25 deletions(-)

Comments

Anders Roxell Sept. 17, 2015, 6:53 p.m. UTC | #1
On 2015-09-17 21:10, hongbo.zhang@freescale.com wrote:
> From: Hongbo Zhang <hongbo.zhang@linaro.org>
> 
> The legacy odp_sys_cpu_hz() is moved to cpu.h then accordingly renamed
> to odp_cpu_hz(), and all the calling functions are also updated.
> 
> Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
> ---
>  example/classifier/odp_classifier.c                 | 2 +-
>  example/generator/odp_generator.c                   | 2 +-
>  example/ipsec/odp_ipsec.c                           | 2 +-
>  example/packet/odp_pktio.c                          | 2 +-
>  example/timer/odp_timer_test.c                      | 4 ++--
>  include/odp/api/cpu.h                               | 9 +++++++++
>  include/odp/api/system_info.h                       | 7 -------
>  platform/linux-generic/arch/linux/odp_time_cycles.c | 2 +-
>  platform/linux-generic/odp_system_info.c            | 2 +-
>  platform/linux-generic/odp_time.c                   | 4 ++--
>  test/api_test/odp_common.c                          | 2 +-
>  test/performance/odp_atomic.c                       | 2 +-
>  test/performance/odp_l2fwd.c                        | 2 +-
>  test/performance/odp_scheduling.c                   | 2 +-
>  test/validation/system/system.c                     | 6 +++---
>  test/validation/system/system.h                     | 2 +-
>  16 files changed, 27 insertions(+), 25 deletions(-)

Wasn't able to build after applying patch 1-4:

Using patch: lng-odp_API_NEXT_PATCH_v6_04-14_api_sysinfo_move_CPU_Hz_API_to_cpu.h.mbox
  Trying to apply patch
  Patch applied
  Building with patch
make[1]: *** [odp_time.lo] Error 1
make: *** [all-recursive] Error 1
BUILD ERROR!
/media/data/src/check-odp/log/odp-apply/lng-odp_API_NEXT_PATCH_v6_04-14_api_sysinfo_move_CPU_Hz_API_to_cpu.h.mbox-make.log


Cheers,
Anders

> 
> diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
> index 021d4dc..8f3c37f 100644
> --- a/example/classifier/odp_classifier.c
> +++ b/example/classifier/odp_classifier.c
> @@ -746,7 +746,7 @@ static void print_info(char *progname, appl_args_t *appl_args)
>  			"CPU count:       %i\n"
>  			"\n",
>  			odp_version_api_str(), odp_cpu_model_str(),
> -			odp_sys_cpu_hz(), odp_sys_cache_line_size(),
> +			odp_cpu_hz(), odp_sys_cache_line_size(),
>  			odp_cpu_count());
>  
>  	printf("Running ODP appl: \"%s\"\n"
> diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
> index 9f9511f..9dd7f3e 100644
> --- a/example/generator/odp_generator.c
> +++ b/example/generator/odp_generator.c
> @@ -1063,7 +1063,7 @@ static void print_info(char *progname, appl_args_t *appl_args)
>  	       "Cache line size: %i\n"
>  	       "CPU count:       %i\n"
>  	       "\n",
> -	       odp_version_api_str(), odp_cpu_model_str(), odp_sys_cpu_hz(),
> +	       odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(),
>  	       odp_sys_cache_line_size(), odp_cpu_count());
>  
>  	printf("Running ODP appl: \"%s\"\n"
> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
> index ee43c3f..5050d8e 100644
> --- a/example/ipsec/odp_ipsec.c
> +++ b/example/ipsec/odp_ipsec.c
> @@ -1534,7 +1534,7 @@ static void print_info(char *progname, appl_args_t *appl_args)
>  	       "Cache line size: %i\n"
>  	       "CPU count:       %i\n"
>  	       "\n",
> -	       odp_version_api_str(), odp_cpu_model_str(), odp_sys_cpu_hz(),
> +	       odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(),
>  	       odp_sys_cache_line_size(), odp_cpu_count());
>  
>  	printf("Running ODP appl: \"%s\"\n"
> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
> index 92bb243..c48364b 100644
> --- a/example/packet/odp_pktio.c
> +++ b/example/packet/odp_pktio.c
> @@ -650,7 +650,7 @@ static void print_info(char *progname, appl_args_t *appl_args)
>  	       "Cache line size: %i\n"
>  	       "CPU count:       %i\n"
>  	       "\n",
> -	       odp_version_api_str(), odp_cpu_model_str(), odp_sys_cpu_hz(),
> +	       odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(),
>  	       odp_sys_cache_line_size(), odp_cpu_count());
>  
>  	printf("Running ODP appl: \"%s\"\n"
> diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
> index bee4be7..67f8742 100644
> --- a/example/timer/odp_timer_test.c
> +++ b/example/timer/odp_timer_test.c
> @@ -350,7 +350,7 @@ int main(int argc, char *argv[])
>  	printf("---------------\n");
>  	printf("ODP API version: %s\n",        odp_version_api_str());
>  	printf("CPU model:       %s\n",        odp_cpu_model_str());
> -	printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
> +	printf("CPU freq (hz):   %"PRIu64"\n", odp_cpu_hz());
>  	printf("Cache line size: %i\n",        odp_sys_cache_line_size());
>  	printf("Max CPU count:   %i\n",        odp_cpu_count());
>  
> @@ -446,7 +446,7 @@ int main(int argc, char *argv[])
>  		return -1;
>  	}
>  
> -	printf("CPU freq %"PRIu64" Hz\n", odp_sys_cpu_hz());
> +	printf("CPU freq %"PRIu64" Hz\n", odp_cpu_hz());
>  	printf("Cycles vs nanoseconds:\n");
>  	ns = 0;
>  	cycles = odp_time_ns_to_cycles(ns);
> diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
> index 78c3ffc..b63a2e9 100644
> --- a/include/odp/api/cpu.h
> +++ b/include/odp/api/cpu.h
> @@ -53,6 +53,15 @@ int odp_cpu_count(void);
>  const char *odp_cpu_model_str(void);
>  
>  /**
> + * Current CPU frequency in Hz
> + *
> + * Returns current frequency of this CPU
> + *
> + * @return CPU frequency in Hz
> + */
> +uint64_t odp_cpu_hz(void);
> +
> +/**
>   * @}
>   */
>  
> diff --git a/include/odp/api/system_info.h b/include/odp/api/system_info.h
> index 1cd883f..bde3a60 100644
> --- a/include/odp/api/system_info.h
> +++ b/include/odp/api/system_info.h
> @@ -24,13 +24,6 @@ extern "C" {
>   */
>  
>  /**
> - * CPU frequency in Hz
> - *
> - * @return CPU frequency in Hz
> - */
> -uint64_t odp_sys_cpu_hz(void);
> -
> -/**
>   * Huge page size in bytes
>   *
>   * @return Huge page size in bytes
> diff --git a/platform/linux-generic/arch/linux/odp_time_cycles.c b/platform/linux-generic/arch/linux/odp_time_cycles.c
> index 4dc0764..035afdf 100644
> --- a/platform/linux-generic/arch/linux/odp_time_cycles.c
> +++ b/platform/linux-generic/arch/linux/odp_time_cycles.c
> @@ -27,7 +27,7 @@ uint64_t odp_time_cycles(void)
>  	if (ret != 0)
>  		ODP_ABORT("clock_gettime failed\n");
>  
> -	hz  = odp_sys_cpu_hz();
> +	hz  = odp_cpu_hz();
>  	sec = (uint64_t) time.tv_sec;
>  	ns  = (uint64_t) time.tv_nsec;
>  
> diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c
> index ed6b515..8e903b0 100644
> --- a/platform/linux-generic/odp_system_info.c
> +++ b/platform/linux-generic/odp_system_info.c
> @@ -374,7 +374,7 @@ int odp_system_info_init(void)
>   * Public access functions
>   *************************
>   */
> -uint64_t odp_sys_cpu_hz(void)
> +uint64_t odp_cpu_hz(void)
>  {
>  	return odp_global_data.system_info.cpu_hz[0];
>  }
> diff --git a/platform/linux-generic/odp_time.c b/platform/linux-generic/odp_time.c
> index a08833d..11e852a 100644
> --- a/platform/linux-generic/odp_time.c
> +++ b/platform/linux-generic/odp_time.c
> @@ -22,7 +22,7 @@ uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
>  
>  uint64_t odp_time_cycles_to_ns(uint64_t cycles)
>  {
> -	uint64_t hz = odp_sys_cpu_hz();
> +	uint64_t hz = odp_cpu_hz();
>  
>  	if (cycles > (UINT64_MAX / GIGA))
>  		return (cycles/hz)*GIGA;
> @@ -33,7 +33,7 @@ uint64_t odp_time_cycles_to_ns(uint64_t cycles)
>  
>  uint64_t odp_time_ns_to_cycles(uint64_t ns)
>  {
> -	uint64_t hz = odp_sys_cpu_hz();
> +	uint64_t hz = odp_cpu_hz();
>  
>  	if (ns > (UINT64_MAX / hz))
>  		return (ns/GIGA)*hz;
> diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
> index f927ea6..8d05efe 100644
> --- a/test/api_test/odp_common.c
> +++ b/test/api_test/odp_common.c
> @@ -42,7 +42,7 @@ void odp_print_system_info(void)
>  	printf("---------------\n");
>  	printf("ODP API version: %s\n",        odp_version_api_str());
>  	printf("CPU model:       %s\n",        odp_cpu_model_str());
> -	printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
> +	printf("CPU freq (hz):   %"PRIu64"\n", odp_cpu_hz());
>  	printf("Cache line size: %i\n",        odp_sys_cache_line_size());
>  	printf("CPU count:       %i\n",        odp_cpu_count());
>  	printf("CPU mask:        %s\n",        str);
> diff --git a/test/performance/odp_atomic.c b/test/performance/odp_atomic.c
> index 29efd1b..74d4f3a 100644
> --- a/test/performance/odp_atomic.c
> +++ b/test/performance/odp_atomic.c
> @@ -338,7 +338,7 @@ void odp_print_system_info(void)
>  	printf("---------------\n");
>  	printf("ODP API version: %s\n",        odp_version_api_str());
>  	printf("CPU model:       %s\n",        odp_cpu_model_str());
> -	printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
> +	printf("CPU freq (hz):   %"PRIu64"\n", odp_cpu_hz());
>  	printf("Cache line size: %i\n",        odp_sys_cache_line_size());
>  	printf("CPU count:       %i\n",        odp_cpu_count());
>  	printf("CPU mask:        %s\n",        str);
> diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
> index 7621948..91138bc 100644
> --- a/test/performance/odp_l2fwd.c
> +++ b/test/performance/odp_l2fwd.c
> @@ -669,7 +669,7 @@ static void print_info(char *progname, appl_args_t *appl_args)
>  	       "Cache line size: %i\n"
>  	       "CPU count:       %i\n"
>  	       "\n",
> -	       odp_version_api_str(), odp_cpu_model_str(), odp_sys_cpu_hz(),
> +	       odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(),
>  	       odp_sys_cache_line_size(), odp_cpu_count());
>  
>  	printf("Running ODP appl: \"%s\"\n"
> diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c
> index c93dd44..72be34d 100644
> --- a/test/performance/odp_scheduling.c
> +++ b/test/performance/odp_scheduling.c
> @@ -879,7 +879,7 @@ int main(int argc, char *argv[])
>  	printf("---------------\n");
>  	printf("ODP API version: %s\n",        odp_version_api_str());
>  	printf("CPU model:       %s\n",        odp_cpu_model_str());
> -	printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
> +	printf("CPU freq (hz):   %"PRIu64"\n", odp_cpu_hz());
>  	printf("Cache line size: %i\n",        odp_sys_cache_line_size());
>  	printf("Max CPU count:   %i\n",        odp_cpu_count());
>  
> diff --git a/test/validation/system/system.c b/test/validation/system/system.c
> index 0a0aa00..7f751a3 100644
> --- a/test/validation/system/system.c
> +++ b/test/validation/system/system.c
> @@ -75,11 +75,11 @@ void system_test_odp_sys_huge_page_size(void)
>  	CU_ASSERT(0 < page);
>  }
>  
> -void system_test_odp_sys_cpu_hz(void)
> +void system_test_odp_cpu_hz(void)
>  {
>  	uint64_t hz;
>  
> -	hz = odp_sys_cpu_hz();
> +	hz = odp_cpu_hz();
>  	CU_ASSERT(0 < hz);
>  }
>  
> @@ -90,7 +90,7 @@ CU_TestInfo system_suite[] = {
>  	_CU_TEST_INFO(system_test_odp_cpu_model_str),
>  	_CU_TEST_INFO(system_test_odp_sys_page_size),
>  	_CU_TEST_INFO(system_test_odp_sys_huge_page_size),
> -	_CU_TEST_INFO(system_test_odp_sys_cpu_hz),
> +	_CU_TEST_INFO(system_test_odp_cpu_hz),
>  	CU_TEST_INFO_NULL,
>  };
>  
> diff --git a/test/validation/system/system.h b/test/validation/system/system.h
> index 2043a54..d05f104 100644
> --- a/test/validation/system/system.h
> +++ b/test/validation/system/system.h
> @@ -16,7 +16,7 @@ void system_test_odp_sys_cache_line_size(void);
>  void system_test_odp_cpu_model_str(void);
>  void system_test_odp_sys_page_size(void);
>  void system_test_odp_sys_huge_page_size(void);
> -void system_test_odp_sys_cpu_hz(void);
> +void system_test_odp_cpu_hz(void);
>  
>  /* test arrays: */
>  extern CU_TestInfo system_suite[];
> -- 
> 1.9.1
> 
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
Hongbo Zhang Sept. 18, 2015, 3:32 a.m. UTC | #2
Anders,
I checked again, I don't have such build error.
I was using the latest odp of yesterday, the last commit is
68f6f93 validation: schedule: don't check schedule time on 0

which version of odp do you use?


On 18 September 2015 at 02:53, Anders Roxell <anders.roxell@linaro.org> wrote:
> On 2015-09-17 21:10, hongbo.zhang@freescale.com wrote:
>> From: Hongbo Zhang <hongbo.zhang@linaro.org>
>>
>> The legacy odp_sys_cpu_hz() is moved to cpu.h then accordingly renamed
>> to odp_cpu_hz(), and all the calling functions are also updated.
>>
>> Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
>> ---
>>  example/classifier/odp_classifier.c                 | 2 +-
>>  example/generator/odp_generator.c                   | 2 +-
>>  example/ipsec/odp_ipsec.c                           | 2 +-
>>  example/packet/odp_pktio.c                          | 2 +-
>>  example/timer/odp_timer_test.c                      | 4 ++--
>>  include/odp/api/cpu.h                               | 9 +++++++++
>>  include/odp/api/system_info.h                       | 7 -------
>>  platform/linux-generic/arch/linux/odp_time_cycles.c | 2 +-
>>  platform/linux-generic/odp_system_info.c            | 2 +-
>>  platform/linux-generic/odp_time.c                   | 4 ++--
>>  test/api_test/odp_common.c                          | 2 +-
>>  test/performance/odp_atomic.c                       | 2 +-
>>  test/performance/odp_l2fwd.c                        | 2 +-
>>  test/performance/odp_scheduling.c                   | 2 +-
>>  test/validation/system/system.c                     | 6 +++---
>>  test/validation/system/system.h                     | 2 +-
>>  16 files changed, 27 insertions(+), 25 deletions(-)
>
> Wasn't able to build after applying patch 1-4:
>
> Using patch: lng-odp_API_NEXT_PATCH_v6_04-14_api_sysinfo_move_CPU_Hz_API_to_cpu.h.mbox
>   Trying to apply patch
>   Patch applied
>   Building with patch
> make[1]: *** [odp_time.lo] Error 1
> make: *** [all-recursive] Error 1
> BUILD ERROR!
> /media/data/src/check-odp/log/odp-apply/lng-odp_API_NEXT_PATCH_v6_04-14_api_sysinfo_move_CPU_Hz_API_to_cpu.h.mbox-make.log
>
>
> Cheers,
> Anders
>
>>
>> diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
>> index 021d4dc..8f3c37f 100644
>> --- a/example/classifier/odp_classifier.c
>> +++ b/example/classifier/odp_classifier.c
>> @@ -746,7 +746,7 @@ static void print_info(char *progname, appl_args_t *appl_args)
>>                       "CPU count:       %i\n"
>>                       "\n",
>>                       odp_version_api_str(), odp_cpu_model_str(),
>> -                     odp_sys_cpu_hz(), odp_sys_cache_line_size(),
>> +                     odp_cpu_hz(), odp_sys_cache_line_size(),
>>                       odp_cpu_count());
>>
>>       printf("Running ODP appl: \"%s\"\n"
>> diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
>> index 9f9511f..9dd7f3e 100644
>> --- a/example/generator/odp_generator.c
>> +++ b/example/generator/odp_generator.c
>> @@ -1063,7 +1063,7 @@ static void print_info(char *progname, appl_args_t *appl_args)
>>              "Cache line size: %i\n"
>>              "CPU count:       %i\n"
>>              "\n",
>> -            odp_version_api_str(), odp_cpu_model_str(), odp_sys_cpu_hz(),
>> +            odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(),
>>              odp_sys_cache_line_size(), odp_cpu_count());
>>
>>       printf("Running ODP appl: \"%s\"\n"
>> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
>> index ee43c3f..5050d8e 100644
>> --- a/example/ipsec/odp_ipsec.c
>> +++ b/example/ipsec/odp_ipsec.c
>> @@ -1534,7 +1534,7 @@ static void print_info(char *progname, appl_args_t *appl_args)
>>              "Cache line size: %i\n"
>>              "CPU count:       %i\n"
>>              "\n",
>> -            odp_version_api_str(), odp_cpu_model_str(), odp_sys_cpu_hz(),
>> +            odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(),
>>              odp_sys_cache_line_size(), odp_cpu_count());
>>
>>       printf("Running ODP appl: \"%s\"\n"
>> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
>> index 92bb243..c48364b 100644
>> --- a/example/packet/odp_pktio.c
>> +++ b/example/packet/odp_pktio.c
>> @@ -650,7 +650,7 @@ static void print_info(char *progname, appl_args_t *appl_args)
>>              "Cache line size: %i\n"
>>              "CPU count:       %i\n"
>>              "\n",
>> -            odp_version_api_str(), odp_cpu_model_str(), odp_sys_cpu_hz(),
>> +            odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(),
>>              odp_sys_cache_line_size(), odp_cpu_count());
>>
>>       printf("Running ODP appl: \"%s\"\n"
>> diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
>> index bee4be7..67f8742 100644
>> --- a/example/timer/odp_timer_test.c
>> +++ b/example/timer/odp_timer_test.c
>> @@ -350,7 +350,7 @@ int main(int argc, char *argv[])
>>       printf("---------------\n");
>>       printf("ODP API version: %s\n",        odp_version_api_str());
>>       printf("CPU model:       %s\n",        odp_cpu_model_str());
>> -     printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
>> +     printf("CPU freq (hz):   %"PRIu64"\n", odp_cpu_hz());
>>       printf("Cache line size: %i\n",        odp_sys_cache_line_size());
>>       printf("Max CPU count:   %i\n",        odp_cpu_count());
>>
>> @@ -446,7 +446,7 @@ int main(int argc, char *argv[])
>>               return -1;
>>       }
>>
>> -     printf("CPU freq %"PRIu64" Hz\n", odp_sys_cpu_hz());
>> +     printf("CPU freq %"PRIu64" Hz\n", odp_cpu_hz());
>>       printf("Cycles vs nanoseconds:\n");
>>       ns = 0;
>>       cycles = odp_time_ns_to_cycles(ns);
>> diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
>> index 78c3ffc..b63a2e9 100644
>> --- a/include/odp/api/cpu.h
>> +++ b/include/odp/api/cpu.h
>> @@ -53,6 +53,15 @@ int odp_cpu_count(void);
>>  const char *odp_cpu_model_str(void);
>>
>>  /**
>> + * Current CPU frequency in Hz
>> + *
>> + * Returns current frequency of this CPU
>> + *
>> + * @return CPU frequency in Hz
>> + */
>> +uint64_t odp_cpu_hz(void);
>> +
>> +/**
>>   * @}
>>   */
>>
>> diff --git a/include/odp/api/system_info.h b/include/odp/api/system_info.h
>> index 1cd883f..bde3a60 100644
>> --- a/include/odp/api/system_info.h
>> +++ b/include/odp/api/system_info.h
>> @@ -24,13 +24,6 @@ extern "C" {
>>   */
>>
>>  /**
>> - * CPU frequency in Hz
>> - *
>> - * @return CPU frequency in Hz
>> - */
>> -uint64_t odp_sys_cpu_hz(void);
>> -
>> -/**
>>   * Huge page size in bytes
>>   *
>>   * @return Huge page size in bytes
>> diff --git a/platform/linux-generic/arch/linux/odp_time_cycles.c b/platform/linux-generic/arch/linux/odp_time_cycles.c
>> index 4dc0764..035afdf 100644
>> --- a/platform/linux-generic/arch/linux/odp_time_cycles.c
>> +++ b/platform/linux-generic/arch/linux/odp_time_cycles.c
>> @@ -27,7 +27,7 @@ uint64_t odp_time_cycles(void)
>>       if (ret != 0)
>>               ODP_ABORT("clock_gettime failed\n");
>>
>> -     hz  = odp_sys_cpu_hz();
>> +     hz  = odp_cpu_hz();
>>       sec = (uint64_t) time.tv_sec;
>>       ns  = (uint64_t) time.tv_nsec;
>>
>> diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c
>> index ed6b515..8e903b0 100644
>> --- a/platform/linux-generic/odp_system_info.c
>> +++ b/platform/linux-generic/odp_system_info.c
>> @@ -374,7 +374,7 @@ int odp_system_info_init(void)
>>   * Public access functions
>>   *************************
>>   */
>> -uint64_t odp_sys_cpu_hz(void)
>> +uint64_t odp_cpu_hz(void)
>>  {
>>       return odp_global_data.system_info.cpu_hz[0];
>>  }
>> diff --git a/platform/linux-generic/odp_time.c b/platform/linux-generic/odp_time.c
>> index a08833d..11e852a 100644
>> --- a/platform/linux-generic/odp_time.c
>> +++ b/platform/linux-generic/odp_time.c
>> @@ -22,7 +22,7 @@ uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
>>
>>  uint64_t odp_time_cycles_to_ns(uint64_t cycles)
>>  {
>> -     uint64_t hz = odp_sys_cpu_hz();
>> +     uint64_t hz = odp_cpu_hz();
>>
>>       if (cycles > (UINT64_MAX / GIGA))
>>               return (cycles/hz)*GIGA;
>> @@ -33,7 +33,7 @@ uint64_t odp_time_cycles_to_ns(uint64_t cycles)
>>
>>  uint64_t odp_time_ns_to_cycles(uint64_t ns)
>>  {
>> -     uint64_t hz = odp_sys_cpu_hz();
>> +     uint64_t hz = odp_cpu_hz();
>>
>>       if (ns > (UINT64_MAX / hz))
>>               return (ns/GIGA)*hz;
>> diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
>> index f927ea6..8d05efe 100644
>> --- a/test/api_test/odp_common.c
>> +++ b/test/api_test/odp_common.c
>> @@ -42,7 +42,7 @@ void odp_print_system_info(void)
>>       printf("---------------\n");
>>       printf("ODP API version: %s\n",        odp_version_api_str());
>>       printf("CPU model:       %s\n",        odp_cpu_model_str());
>> -     printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
>> +     printf("CPU freq (hz):   %"PRIu64"\n", odp_cpu_hz());
>>       printf("Cache line size: %i\n",        odp_sys_cache_line_size());
>>       printf("CPU count:       %i\n",        odp_cpu_count());
>>       printf("CPU mask:        %s\n",        str);
>> diff --git a/test/performance/odp_atomic.c b/test/performance/odp_atomic.c
>> index 29efd1b..74d4f3a 100644
>> --- a/test/performance/odp_atomic.c
>> +++ b/test/performance/odp_atomic.c
>> @@ -338,7 +338,7 @@ void odp_print_system_info(void)
>>       printf("---------------\n");
>>       printf("ODP API version: %s\n",        odp_version_api_str());
>>       printf("CPU model:       %s\n",        odp_cpu_model_str());
>> -     printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
>> +     printf("CPU freq (hz):   %"PRIu64"\n", odp_cpu_hz());
>>       printf("Cache line size: %i\n",        odp_sys_cache_line_size());
>>       printf("CPU count:       %i\n",        odp_cpu_count());
>>       printf("CPU mask:        %s\n",        str);
>> diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
>> index 7621948..91138bc 100644
>> --- a/test/performance/odp_l2fwd.c
>> +++ b/test/performance/odp_l2fwd.c
>> @@ -669,7 +669,7 @@ static void print_info(char *progname, appl_args_t *appl_args)
>>              "Cache line size: %i\n"
>>              "CPU count:       %i\n"
>>              "\n",
>> -            odp_version_api_str(), odp_cpu_model_str(), odp_sys_cpu_hz(),
>> +            odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(),
>>              odp_sys_cache_line_size(), odp_cpu_count());
>>
>>       printf("Running ODP appl: \"%s\"\n"
>> diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c
>> index c93dd44..72be34d 100644
>> --- a/test/performance/odp_scheduling.c
>> +++ b/test/performance/odp_scheduling.c
>> @@ -879,7 +879,7 @@ int main(int argc, char *argv[])
>>       printf("---------------\n");
>>       printf("ODP API version: %s\n",        odp_version_api_str());
>>       printf("CPU model:       %s\n",        odp_cpu_model_str());
>> -     printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
>> +     printf("CPU freq (hz):   %"PRIu64"\n", odp_cpu_hz());
>>       printf("Cache line size: %i\n",        odp_sys_cache_line_size());
>>       printf("Max CPU count:   %i\n",        odp_cpu_count());
>>
>> diff --git a/test/validation/system/system.c b/test/validation/system/system.c
>> index 0a0aa00..7f751a3 100644
>> --- a/test/validation/system/system.c
>> +++ b/test/validation/system/system.c
>> @@ -75,11 +75,11 @@ void system_test_odp_sys_huge_page_size(void)
>>       CU_ASSERT(0 < page);
>>  }
>>
>> -void system_test_odp_sys_cpu_hz(void)
>> +void system_test_odp_cpu_hz(void)
>>  {
>>       uint64_t hz;
>>
>> -     hz = odp_sys_cpu_hz();
>> +     hz = odp_cpu_hz();
>>       CU_ASSERT(0 < hz);
>>  }
>>
>> @@ -90,7 +90,7 @@ CU_TestInfo system_suite[] = {
>>       _CU_TEST_INFO(system_test_odp_cpu_model_str),
>>       _CU_TEST_INFO(system_test_odp_sys_page_size),
>>       _CU_TEST_INFO(system_test_odp_sys_huge_page_size),
>> -     _CU_TEST_INFO(system_test_odp_sys_cpu_hz),
>> +     _CU_TEST_INFO(system_test_odp_cpu_hz),
>>       CU_TEST_INFO_NULL,
>>  };
>>
>> diff --git a/test/validation/system/system.h b/test/validation/system/system.h
>> index 2043a54..d05f104 100644
>> --- a/test/validation/system/system.h
>> +++ b/test/validation/system/system.h
>> @@ -16,7 +16,7 @@ void system_test_odp_sys_cache_line_size(void);
>>  void system_test_odp_cpu_model_str(void);
>>  void system_test_odp_sys_page_size(void);
>>  void system_test_odp_sys_huge_page_size(void);
>> -void system_test_odp_sys_cpu_hz(void);
>> +void system_test_odp_cpu_hz(void);
>>
>>  /* test arrays: */
>>  extern CU_TestInfo system_suite[];
>> --
>> 1.9.1
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>
> --
> Anders Roxell
> anders.roxell@linaro.org
> M: +46 709 71 42 85 | IRC: roxell
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
Anders Roxell Sept. 18, 2015, 4:44 a.m. UTC | #3
On 18 Sep 2015 5:32 am, "Hongbo Zhang" <hongbo.zhang@linaro.org> wrote:
>
> Anders,
> I checked again, I don't have such build error.
> I was using the latest odp of yesterday, the last commit is
> 68f6f93 validation: schedule: don't check schedule time on 0
>
> which version of odp do you use?

Urgh you're probably right... I used master and not apt-next...  I'm sorry.

Cheers,
Anders

>
>
> On 18 September 2015 at 02:53, Anders Roxell <anders.roxell@linaro.org>
wrote:
> > On 2015-09-17 21:10, hongbo.zhang@freescale.com wrote:
> >> From: Hongbo Zhang <hongbo.zhang@linaro.org>
> >>
> >> The legacy odp_sys_cpu_hz() is moved to cpu.h then accordingly renamed
> >> to odp_cpu_hz(), and all the calling functions are also updated.
> >>
> >> Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
> >> ---
> >>  example/classifier/odp_classifier.c                 | 2 +-
> >>  example/generator/odp_generator.c                   | 2 +-
> >>  example/ipsec/odp_ipsec.c                           | 2 +-
> >>  example/packet/odp_pktio.c                          | 2 +-
> >>  example/timer/odp_timer_test.c                      | 4 ++--
> >>  include/odp/api/cpu.h                               | 9 +++++++++
> >>  include/odp/api/system_info.h                       | 7 -------
> >>  platform/linux-generic/arch/linux/odp_time_cycles.c | 2 +-
> >>  platform/linux-generic/odp_system_info.c            | 2 +-
> >>  platform/linux-generic/odp_time.c                   | 4 ++--
> >>  test/api_test/odp_common.c                          | 2 +-
> >>  test/performance/odp_atomic.c                       | 2 +-
> >>  test/performance/odp_l2fwd.c                        | 2 +-
> >>  test/performance/odp_scheduling.c                   | 2 +-
> >>  test/validation/system/system.c                     | 6 +++---
> >>  test/validation/system/system.h                     | 2 +-
> >>  16 files changed, 27 insertions(+), 25 deletions(-)
> >
> > Wasn't able to build after applying patch 1-4:
> >
> > Using patch:
lng-odp_API_NEXT_PATCH_v6_04-14_api_sysinfo_move_CPU_Hz_API_to_cpu.h.mbox
> >   Trying to apply patch
> >   Patch applied
> >   Building with patch
> > make[1]: *** [odp_time.lo] Error 1
> > make: *** [all-recursive] Error 1
> > BUILD ERROR!
> >
/media/data/src/check-odp/log/odp-apply/lng-odp_API_NEXT_PATCH_v6_04-14_api_sysinfo_move_CPU_Hz_API_to_cpu.h.mbox-make.log
> >
> >
> > Cheers,
> > Anders
> >
> >>
> >> diff --git a/example/classifier/odp_classifier.c
b/example/classifier/odp_classifier.c
> >> index 021d4dc..8f3c37f 100644
> >> --- a/example/classifier/odp_classifier.c
> >> +++ b/example/classifier/odp_classifier.c
> >> @@ -746,7 +746,7 @@ static void print_info(char *progname, appl_args_t
*appl_args)
> >>                       "CPU count:       %i\n"
> >>                       "\n",
> >>                       odp_version_api_str(), odp_cpu_model_str(),
> >> -                     odp_sys_cpu_hz(), odp_sys_cache_line_size(),
> >> +                     odp_cpu_hz(), odp_sys_cache_line_size(),
> >>                       odp_cpu_count());
> >>
> >>       printf("Running ODP appl: \"%s\"\n"
> >> diff --git a/example/generator/odp_generator.c
b/example/generator/odp_generator.c
> >> index 9f9511f..9dd7f3e 100644
> >> --- a/example/generator/odp_generator.c
> >> +++ b/example/generator/odp_generator.c
> >> @@ -1063,7 +1063,7 @@ static void print_info(char *progname,
appl_args_t *appl_args)
> >>              "Cache line size: %i\n"
> >>              "CPU count:       %i\n"
> >>              "\n",
> >> -            odp_version_api_str(), odp_cpu_model_str(),
odp_sys_cpu_hz(),
> >> +            odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(),
> >>              odp_sys_cache_line_size(), odp_cpu_count());
> >>
> >>       printf("Running ODP appl: \"%s\"\n"
> >> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
> >> index ee43c3f..5050d8e 100644
> >> --- a/example/ipsec/odp_ipsec.c
> >> +++ b/example/ipsec/odp_ipsec.c
> >> @@ -1534,7 +1534,7 @@ static void print_info(char *progname,
appl_args_t *appl_args)
> >>              "Cache line size: %i\n"
> >>              "CPU count:       %i\n"
> >>              "\n",
> >> -            odp_version_api_str(), odp_cpu_model_str(),
odp_sys_cpu_hz(),
> >> +            odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(),
> >>              odp_sys_cache_line_size(), odp_cpu_count());
> >>
> >>       printf("Running ODP appl: \"%s\"\n"
> >> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
> >> index 92bb243..c48364b 100644
> >> --- a/example/packet/odp_pktio.c
> >> +++ b/example/packet/odp_pktio.c
> >> @@ -650,7 +650,7 @@ static void print_info(char *progname, appl_args_t
*appl_args)
> >>              "Cache line size: %i\n"
> >>              "CPU count:       %i\n"
> >>              "\n",
> >> -            odp_version_api_str(), odp_cpu_model_str(),
odp_sys_cpu_hz(),
> >> +            odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(),
> >>              odp_sys_cache_line_size(), odp_cpu_count());
> >>
> >>       printf("Running ODP appl: \"%s\"\n"
> >> diff --git a/example/timer/odp_timer_test.c
b/example/timer/odp_timer_test.c
> >> index bee4be7..67f8742 100644
> >> --- a/example/timer/odp_timer_test.c
> >> +++ b/example/timer/odp_timer_test.c
> >> @@ -350,7 +350,7 @@ int main(int argc, char *argv[])
> >>       printf("---------------\n");
> >>       printf("ODP API version: %s\n",        odp_version_api_str());
> >>       printf("CPU model:       %s\n",        odp_cpu_model_str());
> >> -     printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
> >> +     printf("CPU freq (hz):   %"PRIu64"\n", odp_cpu_hz());
> >>       printf("Cache line size: %i\n",
odp_sys_cache_line_size());
> >>       printf("Max CPU count:   %i\n",        odp_cpu_count());
> >>
> >> @@ -446,7 +446,7 @@ int main(int argc, char *argv[])
> >>               return -1;
> >>       }
> >>
> >> -     printf("CPU freq %"PRIu64" Hz\n", odp_sys_cpu_hz());
> >> +     printf("CPU freq %"PRIu64" Hz\n", odp_cpu_hz());
> >>       printf("Cycles vs nanoseconds:\n");
> >>       ns = 0;
> >>       cycles = odp_time_ns_to_cycles(ns);
> >> diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
> >> index 78c3ffc..b63a2e9 100644
> >> --- a/include/odp/api/cpu.h
> >> +++ b/include/odp/api/cpu.h
> >> @@ -53,6 +53,15 @@ int odp_cpu_count(void);
> >>  const char *odp_cpu_model_str(void);
> >>
> >>  /**
> >> + * Current CPU frequency in Hz
> >> + *
> >> + * Returns current frequency of this CPU
> >> + *
> >> + * @return CPU frequency in Hz
> >> + */
> >> +uint64_t odp_cpu_hz(void);
> >> +
> >> +/**
> >>   * @}
> >>   */
> >>
> >> diff --git a/include/odp/api/system_info.h
b/include/odp/api/system_info.h
> >> index 1cd883f..bde3a60 100644
> >> --- a/include/odp/api/system_info.h
> >> +++ b/include/odp/api/system_info.h
> >> @@ -24,13 +24,6 @@ extern "C" {
> >>   */
> >>
> >>  /**
> >> - * CPU frequency in Hz
> >> - *
> >> - * @return CPU frequency in Hz
> >> - */
> >> -uint64_t odp_sys_cpu_hz(void);
> >> -
> >> -/**
> >>   * Huge page size in bytes
> >>   *
> >>   * @return Huge page size in bytes
> >> diff --git a/platform/linux-generic/arch/linux/odp_time_cycles.c
b/platform/linux-generic/arch/linux/odp_time_cycles.c
> >> index 4dc0764..035afdf 100644
> >> --- a/platform/linux-generic/arch/linux/odp_time_cycles.c
> >> +++ b/platform/linux-generic/arch/linux/odp_time_cycles.c
> >> @@ -27,7 +27,7 @@ uint64_t odp_time_cycles(void)
> >>       if (ret != 0)
> >>               ODP_ABORT("clock_gettime failed\n");
> >>
> >> -     hz  = odp_sys_cpu_hz();
> >> +     hz  = odp_cpu_hz();
> >>       sec = (uint64_t) time.tv_sec;
> >>       ns  = (uint64_t) time.tv_nsec;
> >>
> >> diff --git a/platform/linux-generic/odp_system_info.c
b/platform/linux-generic/odp_system_info.c
> >> index ed6b515..8e903b0 100644
> >> --- a/platform/linux-generic/odp_system_info.c
> >> +++ b/platform/linux-generic/odp_system_info.c
> >> @@ -374,7 +374,7 @@ int odp_system_info_init(void)
> >>   * Public access functions
> >>   *************************
> >>   */
> >> -uint64_t odp_sys_cpu_hz(void)
> >> +uint64_t odp_cpu_hz(void)
> >>  {
> >>       return odp_global_data.system_info.cpu_hz[0];
> >>  }
> >> diff --git a/platform/linux-generic/odp_time.c
b/platform/linux-generic/odp_time.c
> >> index a08833d..11e852a 100644
> >> --- a/platform/linux-generic/odp_time.c
> >> +++ b/platform/linux-generic/odp_time.c
> >> @@ -22,7 +22,7 @@ uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t
t2)
> >>
> >>  uint64_t odp_time_cycles_to_ns(uint64_t cycles)
> >>  {
> >> -     uint64_t hz = odp_sys_cpu_hz();
> >> +     uint64_t hz = odp_cpu_hz();
> >>
> >>       if (cycles > (UINT64_MAX / GIGA))
> >>               return (cycles/hz)*GIGA;
> >> @@ -33,7 +33,7 @@ uint64_t odp_time_cycles_to_ns(uint64_t cycles)
> >>
> >>  uint64_t odp_time_ns_to_cycles(uint64_t ns)
> >>  {
> >> -     uint64_t hz = odp_sys_cpu_hz();
> >> +     uint64_t hz = odp_cpu_hz();
> >>
> >>       if (ns > (UINT64_MAX / hz))
> >>               return (ns/GIGA)*hz;
> >> diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
> >> index f927ea6..8d05efe 100644
> >> --- a/test/api_test/odp_common.c
> >> +++ b/test/api_test/odp_common.c
> >> @@ -42,7 +42,7 @@ void odp_print_system_info(void)
> >>       printf("---------------\n");
> >>       printf("ODP API version: %s\n",        odp_version_api_str());
> >>       printf("CPU model:       %s\n",        odp_cpu_model_str());
> >> -     printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
> >> +     printf("CPU freq (hz):   %"PRIu64"\n", odp_cpu_hz());
> >>       printf("Cache line size: %i\n",
odp_sys_cache_line_size());
> >>       printf("CPU count:       %i\n",        odp_cpu_count());
> >>       printf("CPU mask:        %s\n",        str);
> >> diff --git a/test/performance/odp_atomic.c
b/test/performance/odp_atomic.c
> >> index 29efd1b..74d4f3a 100644
> >> --- a/test/performance/odp_atomic.c
> >> +++ b/test/performance/odp_atomic.c
> >> @@ -338,7 +338,7 @@ void odp_print_system_info(void)
> >>       printf("---------------\n");
> >>       printf("ODP API version: %s\n",        odp_version_api_str());
> >>       printf("CPU model:       %s\n",        odp_cpu_model_str());
> >> -     printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
> >> +     printf("CPU freq (hz):   %"PRIu64"\n", odp_cpu_hz());
> >>       printf("Cache line size: %i\n",
odp_sys_cache_line_size());
> >>       printf("CPU count:       %i\n",        odp_cpu_count());
> >>       printf("CPU mask:        %s\n",        str);
> >> diff --git a/test/performance/odp_l2fwd.c
b/test/performance/odp_l2fwd.c
> >> index 7621948..91138bc 100644
> >> --- a/test/performance/odp_l2fwd.c
> >> +++ b/test/performance/odp_l2fwd.c
> >> @@ -669,7 +669,7 @@ static void print_info(char *progname, appl_args_t
*appl_args)
> >>              "Cache line size: %i\n"
> >>              "CPU count:       %i\n"
> >>              "\n",
> >> -            odp_version_api_str(), odp_cpu_model_str(),
odp_sys_cpu_hz(),
> >> +            odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(),
> >>              odp_sys_cache_line_size(), odp_cpu_count());
> >>
> >>       printf("Running ODP appl: \"%s\"\n"
> >> diff --git a/test/performance/odp_scheduling.c
b/test/performance/odp_scheduling.c
> >> index c93dd44..72be34d 100644
> >> --- a/test/performance/odp_scheduling.c
> >> +++ b/test/performance/odp_scheduling.c
> >> @@ -879,7 +879,7 @@ int main(int argc, char *argv[])
> >>       printf("---------------\n");
> >>       printf("ODP API version: %s\n",        odp_version_api_str());
> >>       printf("CPU model:       %s\n",        odp_cpu_model_str());
> >> -     printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
> >> +     printf("CPU freq (hz):   %"PRIu64"\n", odp_cpu_hz());
> >>       printf("Cache line size: %i\n",
odp_sys_cache_line_size());
> >>       printf("Max CPU count:   %i\n",        odp_cpu_count());
> >>
> >> diff --git a/test/validation/system/system.c
b/test/validation/system/system.c
> >> index 0a0aa00..7f751a3 100644
> >> --- a/test/validation/system/system.c
> >> +++ b/test/validation/system/system.c
> >> @@ -75,11 +75,11 @@ void system_test_odp_sys_huge_page_size(void)
> >>       CU_ASSERT(0 < page);
> >>  }
> >>
> >> -void system_test_odp_sys_cpu_hz(void)
> >> +void system_test_odp_cpu_hz(void)
> >>  {
> >>       uint64_t hz;
> >>
> >> -     hz = odp_sys_cpu_hz();
> >> +     hz = odp_cpu_hz();
> >>       CU_ASSERT(0 < hz);
> >>  }
> >>
> >> @@ -90,7 +90,7 @@ CU_TestInfo system_suite[] = {
> >>       _CU_TEST_INFO(system_test_odp_cpu_model_str),
> >>       _CU_TEST_INFO(system_test_odp_sys_page_size),
> >>       _CU_TEST_INFO(system_test_odp_sys_huge_page_size),
> >> -     _CU_TEST_INFO(system_test_odp_sys_cpu_hz),
> >> +     _CU_TEST_INFO(system_test_odp_cpu_hz),
> >>       CU_TEST_INFO_NULL,
> >>  };
> >>
> >> diff --git a/test/validation/system/system.h
b/test/validation/system/system.h
> >> index 2043a54..d05f104 100644
> >> --- a/test/validation/system/system.h
> >> +++ b/test/validation/system/system.h
> >> @@ -16,7 +16,7 @@ void system_test_odp_sys_cache_line_size(void);
> >>  void system_test_odp_cpu_model_str(void);
> >>  void system_test_odp_sys_page_size(void);
> >>  void system_test_odp_sys_huge_page_size(void);
> >> -void system_test_odp_sys_cpu_hz(void);
> >> +void system_test_odp_cpu_hz(void);
> >>
> >>  /* test arrays: */
> >>  extern CU_TestInfo system_suite[];
> >> --
> >> 1.9.1
> >>
> >> _______________________________________________
> >> lng-odp mailing list
> >> lng-odp@lists.linaro.org
> >> https://lists.linaro.org/mailman/listinfo/lng-odp
> >
> > --
> > Anders Roxell
> > anders.roxell@linaro.org
> > M: +46 709 71 42 85 | IRC: roxell
> > _______________________________________________
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
index 021d4dc..8f3c37f 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -746,7 +746,7 @@  static void print_info(char *progname, appl_args_t *appl_args)
 			"CPU count:       %i\n"
 			"\n",
 			odp_version_api_str(), odp_cpu_model_str(),
-			odp_sys_cpu_hz(), odp_sys_cache_line_size(),
+			odp_cpu_hz(), odp_sys_cache_line_size(),
 			odp_cpu_count());
 
 	printf("Running ODP appl: \"%s\"\n"
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index 9f9511f..9dd7f3e 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -1063,7 +1063,7 @@  static void print_info(char *progname, appl_args_t *appl_args)
 	       "Cache line size: %i\n"
 	       "CPU count:       %i\n"
 	       "\n",
-	       odp_version_api_str(), odp_cpu_model_str(), odp_sys_cpu_hz(),
+	       odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(),
 	       odp_sys_cache_line_size(), odp_cpu_count());
 
 	printf("Running ODP appl: \"%s\"\n"
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index ee43c3f..5050d8e 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -1534,7 +1534,7 @@  static void print_info(char *progname, appl_args_t *appl_args)
 	       "Cache line size: %i\n"
 	       "CPU count:       %i\n"
 	       "\n",
-	       odp_version_api_str(), odp_cpu_model_str(), odp_sys_cpu_hz(),
+	       odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(),
 	       odp_sys_cache_line_size(), odp_cpu_count());
 
 	printf("Running ODP appl: \"%s\"\n"
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 92bb243..c48364b 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -650,7 +650,7 @@  static void print_info(char *progname, appl_args_t *appl_args)
 	       "Cache line size: %i\n"
 	       "CPU count:       %i\n"
 	       "\n",
-	       odp_version_api_str(), odp_cpu_model_str(), odp_sys_cpu_hz(),
+	       odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(),
 	       odp_sys_cache_line_size(), odp_cpu_count());
 
 	printf("Running ODP appl: \"%s\"\n"
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index bee4be7..67f8742 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -350,7 +350,7 @@  int main(int argc, char *argv[])
 	printf("---------------\n");
 	printf("ODP API version: %s\n",        odp_version_api_str());
 	printf("CPU model:       %s\n",        odp_cpu_model_str());
-	printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
+	printf("CPU freq (hz):   %"PRIu64"\n", odp_cpu_hz());
 	printf("Cache line size: %i\n",        odp_sys_cache_line_size());
 	printf("Max CPU count:   %i\n",        odp_cpu_count());
 
@@ -446,7 +446,7 @@  int main(int argc, char *argv[])
 		return -1;
 	}
 
-	printf("CPU freq %"PRIu64" Hz\n", odp_sys_cpu_hz());
+	printf("CPU freq %"PRIu64" Hz\n", odp_cpu_hz());
 	printf("Cycles vs nanoseconds:\n");
 	ns = 0;
 	cycles = odp_time_ns_to_cycles(ns);
diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
index 78c3ffc..b63a2e9 100644
--- a/include/odp/api/cpu.h
+++ b/include/odp/api/cpu.h
@@ -53,6 +53,15 @@  int odp_cpu_count(void);
 const char *odp_cpu_model_str(void);
 
 /**
+ * Current CPU frequency in Hz
+ *
+ * Returns current frequency of this CPU
+ *
+ * @return CPU frequency in Hz
+ */
+uint64_t odp_cpu_hz(void);
+
+/**
  * @}
  */
 
diff --git a/include/odp/api/system_info.h b/include/odp/api/system_info.h
index 1cd883f..bde3a60 100644
--- a/include/odp/api/system_info.h
+++ b/include/odp/api/system_info.h
@@ -24,13 +24,6 @@  extern "C" {
  */
 
 /**
- * CPU frequency in Hz
- *
- * @return CPU frequency in Hz
- */
-uint64_t odp_sys_cpu_hz(void);
-
-/**
  * Huge page size in bytes
  *
  * @return Huge page size in bytes
diff --git a/platform/linux-generic/arch/linux/odp_time_cycles.c b/platform/linux-generic/arch/linux/odp_time_cycles.c
index 4dc0764..035afdf 100644
--- a/platform/linux-generic/arch/linux/odp_time_cycles.c
+++ b/platform/linux-generic/arch/linux/odp_time_cycles.c
@@ -27,7 +27,7 @@  uint64_t odp_time_cycles(void)
 	if (ret != 0)
 		ODP_ABORT("clock_gettime failed\n");
 
-	hz  = odp_sys_cpu_hz();
+	hz  = odp_cpu_hz();
 	sec = (uint64_t) time.tv_sec;
 	ns  = (uint64_t) time.tv_nsec;
 
diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c
index ed6b515..8e903b0 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -374,7 +374,7 @@  int odp_system_info_init(void)
  * Public access functions
  *************************
  */
-uint64_t odp_sys_cpu_hz(void)
+uint64_t odp_cpu_hz(void)
 {
 	return odp_global_data.system_info.cpu_hz[0];
 }
diff --git a/platform/linux-generic/odp_time.c b/platform/linux-generic/odp_time.c
index a08833d..11e852a 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -22,7 +22,7 @@  uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
 
 uint64_t odp_time_cycles_to_ns(uint64_t cycles)
 {
-	uint64_t hz = odp_sys_cpu_hz();
+	uint64_t hz = odp_cpu_hz();
 
 	if (cycles > (UINT64_MAX / GIGA))
 		return (cycles/hz)*GIGA;
@@ -33,7 +33,7 @@  uint64_t odp_time_cycles_to_ns(uint64_t cycles)
 
 uint64_t odp_time_ns_to_cycles(uint64_t ns)
 {
-	uint64_t hz = odp_sys_cpu_hz();
+	uint64_t hz = odp_cpu_hz();
 
 	if (ns > (UINT64_MAX / hz))
 		return (ns/GIGA)*hz;
diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
index f927ea6..8d05efe 100644
--- a/test/api_test/odp_common.c
+++ b/test/api_test/odp_common.c
@@ -42,7 +42,7 @@  void odp_print_system_info(void)
 	printf("---------------\n");
 	printf("ODP API version: %s\n",        odp_version_api_str());
 	printf("CPU model:       %s\n",        odp_cpu_model_str());
-	printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
+	printf("CPU freq (hz):   %"PRIu64"\n", odp_cpu_hz());
 	printf("Cache line size: %i\n",        odp_sys_cache_line_size());
 	printf("CPU count:       %i\n",        odp_cpu_count());
 	printf("CPU mask:        %s\n",        str);
diff --git a/test/performance/odp_atomic.c b/test/performance/odp_atomic.c
index 29efd1b..74d4f3a 100644
--- a/test/performance/odp_atomic.c
+++ b/test/performance/odp_atomic.c
@@ -338,7 +338,7 @@  void odp_print_system_info(void)
 	printf("---------------\n");
 	printf("ODP API version: %s\n",        odp_version_api_str());
 	printf("CPU model:       %s\n",        odp_cpu_model_str());
-	printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
+	printf("CPU freq (hz):   %"PRIu64"\n", odp_cpu_hz());
 	printf("Cache line size: %i\n",        odp_sys_cache_line_size());
 	printf("CPU count:       %i\n",        odp_cpu_count());
 	printf("CPU mask:        %s\n",        str);
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 7621948..91138bc 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -669,7 +669,7 @@  static void print_info(char *progname, appl_args_t *appl_args)
 	       "Cache line size: %i\n"
 	       "CPU count:       %i\n"
 	       "\n",
-	       odp_version_api_str(), odp_cpu_model_str(), odp_sys_cpu_hz(),
+	       odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(),
 	       odp_sys_cache_line_size(), odp_cpu_count());
 
 	printf("Running ODP appl: \"%s\"\n"
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c
index c93dd44..72be34d 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -879,7 +879,7 @@  int main(int argc, char *argv[])
 	printf("---------------\n");
 	printf("ODP API version: %s\n",        odp_version_api_str());
 	printf("CPU model:       %s\n",        odp_cpu_model_str());
-	printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
+	printf("CPU freq (hz):   %"PRIu64"\n", odp_cpu_hz());
 	printf("Cache line size: %i\n",        odp_sys_cache_line_size());
 	printf("Max CPU count:   %i\n",        odp_cpu_count());
 
diff --git a/test/validation/system/system.c b/test/validation/system/system.c
index 0a0aa00..7f751a3 100644
--- a/test/validation/system/system.c
+++ b/test/validation/system/system.c
@@ -75,11 +75,11 @@  void system_test_odp_sys_huge_page_size(void)
 	CU_ASSERT(0 < page);
 }
 
-void system_test_odp_sys_cpu_hz(void)
+void system_test_odp_cpu_hz(void)
 {
 	uint64_t hz;
 
-	hz = odp_sys_cpu_hz();
+	hz = odp_cpu_hz();
 	CU_ASSERT(0 < hz);
 }
 
@@ -90,7 +90,7 @@  CU_TestInfo system_suite[] = {
 	_CU_TEST_INFO(system_test_odp_cpu_model_str),
 	_CU_TEST_INFO(system_test_odp_sys_page_size),
 	_CU_TEST_INFO(system_test_odp_sys_huge_page_size),
-	_CU_TEST_INFO(system_test_odp_sys_cpu_hz),
+	_CU_TEST_INFO(system_test_odp_cpu_hz),
 	CU_TEST_INFO_NULL,
 };
 
diff --git a/test/validation/system/system.h b/test/validation/system/system.h
index 2043a54..d05f104 100644
--- a/test/validation/system/system.h
+++ b/test/validation/system/system.h
@@ -16,7 +16,7 @@  void system_test_odp_sys_cache_line_size(void);
 void system_test_odp_cpu_model_str(void);
 void system_test_odp_sys_page_size(void);
 void system_test_odp_sys_huge_page_size(void);
-void system_test_odp_sys_cpu_hz(void);
+void system_test_odp_cpu_hz(void);
 
 /* test arrays: */
 extern CU_TestInfo system_suite[];