Update contrib.
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
22 #define LOG_FILE "c:\\logs\\memcpy-speed_logs.txt"
23 #include "std_log_result.h"
24 #define LOG_FILENAME_LINE __FILE__, __LINE__
26 void create_xml(int result)
31 testResultXml("memcpy-speed");
35 #include <liboil/liboil.h>
36 #include <liboil/liboilprofile.h>
37 #include <liboil/liboilfunction.h>
38 #include <liboil/globals.h>
40 #define ALIGN(ptr,n) ((void *)((unsigned long)(ptr) & (~(unsigned long)(n-1))))
43 main(int argc, char *argv[])
45 char *s=NULL, *d=NULL;
52 OilFunctionClass *klass;
53 OilFunctionImpl *impl;
56 std_log(LOG_FILENAME_LINE,"Test Started memcpy-speed");
60 s = malloc(512*1024+1024);
61 d = malloc(512*1024+1024);
62 // src = ((void *)((unsigned long)(s) | 0xFF ));
63 //dest = ((void *)((unsigned long)(d) | 0xFF ));
64 src = ((void *)((unsigned long)(s) ));
65 dest = ((void *)((unsigned long)(d) ));
67 for(the_class=0; the_class<3; the_class++)
72 klass = oil_class_get ("splat_u32_ns");
75 klass = oil_class_get ("copy_u8");
78 klass = oil_class_get ("sum_s16");
82 for(impl=klass->first_impl;impl;impl=impl->next) {
83 std_log(LOG_FILENAME_LINE,"impl %s\n", impl->name);
85 if (!oil_impl_is_usable(impl)) {
86 std_log(LOG_FILENAME_LINE," not usable\n");
90 oil_class_choose_by_name (klass, impl->name);
93 oil_profile_init (&prof);
97 oil_profile_start(&prof);
98 oil_splat_u32_ns (dest, src, 1<<(i-2));
99 oil_profile_stop(&prof);
100 for(cnt=0; cnt<(1<<(i-2)); cnt++){
102 std_log(LOG_FILENAME_LINE,"Failed at the_class=%d, cnt=%d, i=%d, j=%d, impl->name=%s\n", the_class, cnt, i, j, impl->name);
109 oil_profile_start(&prof);
110 oil_memcpy (dest, src, 1<<i);
111 oil_profile_stop(&prof);
112 for(cnt=0; cnt<(1<<(i-2)); cnt++){ //cnt is checked with 1<<(i-2) because dest & src are of type uint32_t*
113 if(dest[cnt]!=src[cnt]){
114 std_log(LOG_FILENAME_LINE,"Failed at the_class=%d, cnt=%d, i=%d, j=%d, impl->name=%s\n", the_class, cnt, i, j, impl->name);
122 int16_t* src1 = (int16_t*)src;
123 int16_t* dest1 = (int16_t*)dest;
124 oil_profile_start(&prof);
125 oil_sum_s16 (dest1, src1, 1<<(i-1));
126 oil_profile_stop(&prof);
128 for(cnt=0; cnt<(1<<(i-1)); cnt++){
132 std_log(LOG_FILENAME_LINE,"Failed at the_class=%d, impl->name=%s\n", the_class, impl->name);
140 oil_profile_get_ave_std (&prof, &ave, &std);
141 std_log(LOG_FILENAME_LINE,"%d: %10.4g %10.4g %10.4g\n", i, ave, std,
152 std_log(LOG_FILENAME_LINE, "Test Passed");
154 std_log(LOG_FILENAME_LINE, "Test Failed");