os/kernelhwsrv/kerneltest/e32test/bench/t_r64fnc.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/bench/t_r64fnc.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,288 @@
     1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32test\bench\t_r64fnc.cpp
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#include <e32std.h>
    1.22 +#include <e32std_private.h>
    1.23 +#include <e32math.h>
    1.24 +
    1.25 +volatile TReal64 Zero(0);
    1.26 +volatile TReal64 One(1);
    1.27 +volatile TReal64 Two(2);
    1.28 +volatile TReal64 Ten(10);
    1.29 +volatile TReal64 Pi(3.14159265358979323846);
    1.30 +volatile TReal64 TenPoint01(10.01);
    1.31 +
    1.32 +volatile TReal64 r(0);
    1.33 +
    1.34 +TReal64 AntiOptimization[16] = {0.1,	1,	3.14159265358979323846,		10.01,
    1.35 +								2.7,	3,	27.2,	11.23,
    1.36 +								76.1,	9,	56.1,	1/9,
    1.37 +								1/3,	22,	99.7,	42};
    1.38 +
    1.39 +GLREF_D volatile TUint count;
    1.40 +
    1.41 +TInt TReal64Addition(TAny*)
    1.42 +    {
    1.43 +	count=0;
    1.44 +
    1.45 +    FOREVER
    1.46 +        {
    1.47 +		r=AntiOptimization[count & 0xf];
    1.48 +		r+=One;
    1.49 +		r+=One;
    1.50 +		r+=One;
    1.51 +		r+=One;
    1.52 +		r+=One;
    1.53 +		r+=One;
    1.54 +		r+=One;
    1.55 +		r+=One;
    1.56 +		r+=One;
    1.57 +		r+=One;
    1.58 +        count++;
    1.59 +        }
    1.60 +    }
    1.61 +
    1.62 +TInt TReal64Subtraction(TAny*)
    1.63 +    {
    1.64 +	count=0;
    1.65 +
    1.66 +    FOREVER
    1.67 +        {
    1.68 +		r=AntiOptimization[count & 0xf];
    1.69 +		r-=Ten;
    1.70 +		r-=Ten;
    1.71 +		r-=Ten;
    1.72 +		r-=Ten;
    1.73 +		r-=Ten;
    1.74 +		r-=Ten;
    1.75 +		r-=Ten;
    1.76 +		r-=Ten;
    1.77 +		r-=Ten;
    1.78 +		r-=Ten;
    1.79 +        count++;
    1.80 +        }
    1.81 +    }
    1.82 +
    1.83 +TInt TReal64Multiplication(TAny*)
    1.84 +    {
    1.85 +	count=0;
    1.86 +    FOREVER
    1.87 +        {
    1.88 +		r=AntiOptimization[count & 0xf];
    1.89 +		r*=Pi;
    1.90 +		r*=Pi;
    1.91 +		r*=Pi;
    1.92 +		r*=Pi;
    1.93 +		r*=Pi;
    1.94 +		r*=Pi;
    1.95 +		r*=Pi;
    1.96 +		r*=Pi;
    1.97 +		r*=Pi;
    1.98 +		r*=Pi;
    1.99 +        count++;
   1.100 +        }
   1.101 +    }
   1.102 +
   1.103 +TInt TReal64Division(TAny*)
   1.104 +    {
   1.105 +	count=0;
   1.106 +	
   1.107 +    FOREVER
   1.108 +        {
   1.109 +		r=AntiOptimization[count & 0xf];
   1.110 +		r/=Ten;
   1.111 +		r/=Ten;
   1.112 +		r/=Ten;
   1.113 +		r/=Ten;
   1.114 +		r/=Ten;
   1.115 +		r/=Ten;
   1.116 +		r/=Ten;
   1.117 +		r/=Ten;
   1.118 +		r/=Ten;
   1.119 +		r/=Ten;
   1.120 +        count++;
   1.121 +        }
   1.122 +    }
   1.123 +
   1.124 +TInt TRealSqrt(TAny*)
   1.125 +    {
   1.126 +
   1.127 +	TReal r;
   1.128 +
   1.129 +    FOREVER
   1.130 +        {
   1.131 +		Math::Sqrt(r,2.0);
   1.132 +		Math::Sqrt(r,3.0);
   1.133 +		Math::Sqrt(r,4.0);
   1.134 +		Math::Sqrt(r,5.0);
   1.135 +		Math::Sqrt(r,3.14159265358979323846);
   1.136 +		Math::Sqrt(r,2.71828182845904524);
   1.137 +		Math::Sqrt(r,0.69314718055994531);
   1.138 +		Math::Sqrt(r,1.414213562373);
   1.139 +		Math::Sqrt(r,1.7320508078);
   1.140 +		Math::Sqrt(r,299792458.0);
   1.141 +        count++;
   1.142 +        }
   1.143 +    }
   1.144 +
   1.145 +TInt TRealSin(TAny*)
   1.146 +    {
   1.147 +
   1.148 +	TReal r=7;
   1.149 +
   1.150 +    FOREVER
   1.151 +        {
   1.152 +		Math::Sin(r,1.0);
   1.153 +		Math::Sin(r,2.0);
   1.154 +		Math::Sin(r,3.0);
   1.155 +		Math::Sin(r,4.0);
   1.156 +		Math::Sin(r,5.0);
   1.157 +		Math::Sin(r,6.0);
   1.158 +		Math::Sin(r,7.0);
   1.159 +		Math::Sin(r,8.0);
   1.160 +		Math::Sin(r,9.0);
   1.161 +		Math::Sin(r,-1.0);
   1.162 +        count++;
   1.163 +        }
   1.164 +    }
   1.165 +
   1.166 +TInt TRealLn(TAny*)
   1.167 +    {
   1.168 +
   1.169 +	TReal r=7;
   1.170 +
   1.171 +    FOREVER
   1.172 +        {
   1.173 +		Math::Ln(r,3.141592653589793238);
   1.174 +		Math::Ln(r,2.718281828459045235);
   1.175 +		Math::Ln(r,7.389056098930650227);
   1.176 +		Math::Ln(r,2.0);
   1.177 +		Math::Ln(r,3.0);
   1.178 +		Math::Ln(r,5.0);
   1.179 +		Math::Ln(r,7.0);
   1.180 +		Math::Ln(r,11.0);
   1.181 +		Math::Ln(r,13.0);
   1.182 +		Math::Ln(r,17.0);
   1.183 +        count++;
   1.184 +        }
   1.185 +    }
   1.186 +
   1.187 +TInt TRealExp(TAny*)
   1.188 +    {
   1.189 +
   1.190 +	TReal r=7;
   1.191 +
   1.192 +    FOREVER
   1.193 +        {
   1.194 +		Math::Exp(r,3.14159265358979323846);
   1.195 +		Math::Exp(r,-3.14159265358979323846);
   1.196 +		Math::Exp(r,0.69314718056);
   1.197 +		Math::Exp(r,-0.69314718056);
   1.198 +		Math::Exp(r,1.0);
   1.199 +		Math::Exp(r,-1.0);
   1.200 +		Math::Exp(r,2.0);
   1.201 +		Math::Exp(r,-2.0);
   1.202 +		Math::Exp(r,11.0);
   1.203 +		Math::Exp(r,-11.0);
   1.204 +        count++;
   1.205 +        }
   1.206 +    }
   1.207 +
   1.208 +TInt TRealAsin(TAny*)
   1.209 +    {
   1.210 +
   1.211 +	TReal r=7;
   1.212 +
   1.213 +    FOREVER
   1.214 +        {
   1.215 +		Math::ASin(r,0.1);
   1.216 +		Math::ASin(r,0.2);
   1.217 +		Math::ASin(r,0.3);
   1.218 +		Math::ASin(r,0.4);
   1.219 +		Math::ASin(r,0.5);
   1.220 +		Math::ASin(r,0.6);
   1.221 +		Math::ASin(r,0.7);
   1.222 +		Math::ASin(r,0.8);
   1.223 +		Math::ASin(r,0.9);
   1.224 +		Math::ASin(r,-0.9);
   1.225 +        count++;
   1.226 +        }
   1.227 +    }
   1.228 +
   1.229 +TInt TRealAtan(TAny*)
   1.230 +    {
   1.231 +
   1.232 +	TReal r=7;
   1.233 +
   1.234 +    FOREVER
   1.235 +        {
   1.236 +		Math::ATan(r,0.1);
   1.237 +		Math::ATan(r,0.3);
   1.238 +		Math::ATan(r,0.5);
   1.239 +		Math::ATan(r,0.7);
   1.240 +		Math::ATan(r,0.9);
   1.241 +		Math::ATan(r,1.1);
   1.242 +		Math::ATan(r,1.3);
   1.243 +		Math::ATan(r,1.5);
   1.244 +		Math::ATan(r,1.7);
   1.245 +		Math::ATan(r,2.9);
   1.246 +        count++;
   1.247 +        }
   1.248 +    }
   1.249 +
   1.250 +TInt TRealTan(TAny*)
   1.251 +    {
   1.252 +
   1.253 +	TReal r=7;
   1.254 +
   1.255 +    FOREVER
   1.256 +        {
   1.257 +		Math::Tan(r,1.0);
   1.258 +		Math::Tan(r,2.0);
   1.259 +		Math::Tan(r,3.0);
   1.260 +		Math::Tan(r,4.0);
   1.261 +		Math::Tan(r,5.0);
   1.262 +		Math::Tan(r,6.0);
   1.263 +		Math::Tan(r,7.0);
   1.264 +		Math::Tan(r,8.0);
   1.265 +		Math::Tan(r,9.0);
   1.266 +		Math::Tan(r,-1.0);
   1.267 +        count++;
   1.268 +        }
   1.269 +    }
   1.270 +
   1.271 +TInt TRealPower(TAny*)
   1.272 +    {
   1.273 +
   1.274 +	TReal r=7;
   1.275 +
   1.276 +    FOREVER
   1.277 +        {
   1.278 +		Math::Pow(r,2.718281828459045235,2.718281828459045235);
   1.279 +		Math::Pow(r,3.141592653589793238,3.141592653589793238);
   1.280 +		Math::Pow(r,1.414213562373,3.1);
   1.281 +		Math::Pow(r,299792458,0.70710678118);
   1.282 +		Math::Pow(r,1.989e30,0.1);
   1.283 +		Math::Pow(r,0.86602540378,-1.6180334);
   1.284 +		Math::Pow(r,7.0,0.5772156649);
   1.285 +		Math::Pow(r,95.4,1.57079);
   1.286 +		Math::Pow(r,317.9,0.3333333333333333);
   1.287 +		Math::Pow(r,299792458,-2.718281828459045235);
   1.288 +        count++;
   1.289 +        }
   1.290 +    }
   1.291 +