mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-29 16:56:30 +00:00
122 lines
11 KiB
HTML
Executable file
122 lines
11 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.10">
|
|
<style type="text/css">
|
|
body {background-color:#000000;}
|
|
.cF0{color:#ffffff;background-color:#000000;}
|
|
.cF1{color:#3465a4;background-color:#000000;}
|
|
.cF2{color:#4e9a06;background-color:#000000;}
|
|
.cF3{color:#06989a;background-color:#000000;}
|
|
.cF4{color:#a24444;background-color:#000000;}
|
|
.cF5{color:#75507b;background-color:#000000;}
|
|
.cF6{color:#ce982f;background-color:#000000;}
|
|
.cF7{color:#bcc0b9;background-color:#000000;}
|
|
.cF8{color:#555753;background-color:#000000;}
|
|
.cF9{color:#729fcf;background-color:#000000;}
|
|
.cFA{color:#82bc49;background-color:#000000;}
|
|
.cFB{color:#34e2e2;background-color:#000000;}
|
|
.cFC{color:#ac3535;background-color:#000000;}
|
|
.cFD{color:#ad7fa8;background-color:#000000;}
|
|
.cFE{color:#fce94f;background-color:#000000;}
|
|
.cFF{color:#000000;background-color:#000000;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF9>I64</span><span class=cF0> mp_n;
|
|
<a name="l2"></a>
|
|
<a name="l3"></a></span><span class=cF9>I64</span><span class=cF0> MPSum(</span><span class=cF9>I64</span><span class=cF0> my_mp_count)
|
|
<a name="l4"></a>{</span><span class=cF2>//We could use the formula n*(n+1)/2</span><span class=cF0>
|
|
<a name="l5"></a> </span><span class=cF9>I64</span><span class=cF0> lo = mp_n * </span><span class=cF5>Gs</span><span class=cF0>->num / my_mp_count,
|
|
<a name="l6"></a> hi = mp_n * (</span><span class=cF5>Gs</span><span class=cF0>->num + </span><span class=cFE>1</span><span class=cF0>) / my_mp_count,
|
|
<a name="l7"></a> res = </span><span class=cFE>0</span><span class=cF0>, i;
|
|
<a name="l8"></a>
|
|
<a name="l9"></a> </span><span class=cF1>for</span><span class=cF0> (i = lo; i < hi; i++)
|
|
<a name="l10"></a> res += i;
|
|
<a name="l11"></a>
|
|
<a name="l12"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l13"></a>}
|
|
<a name="l14"></a>
|
|
<a name="l15"></a></span><span class=cF9>I64</span><span class=cF0> Sum(</span><span class=cF9>I64</span><span class=cF0> n, </span><span class=cF9>I64</span><span class=cF0> my_mp_count)
|
|
<a name="l16"></a>{
|
|
<a name="l17"></a> </span><span class=cF9>CJob</span><span class=cF0> *tmpm[</span><span class=cF3>MP_PROCESSORS_NUM</span><span class=cF0>];
|
|
<a name="l18"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>, i;
|
|
<a name="l19"></a>
|
|
<a name="l20"></a> mp_n = n + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l21"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < my_mp_count; i++)
|
|
<a name="l22"></a> tmpm[i] = </span><span class=cF5>JobQueue</span><span class=cF0>(&MPSum, my_mp_count, i, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l23"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < my_mp_count; i++)
|
|
<a name="l24"></a> res += </span><span class=cF5>JobResGet</span><span class=cF0>(tmpm[i]);
|
|
<a name="l25"></a>
|
|
<a name="l26"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l27"></a>}
|
|
<a name="l28"></a>
|
|
<a name="l29"></a>#</span><span class=cF1>define</span><span class=cF0> SAMPLE_SIZE </span><span class=cFE>100</span><span class=cF0>
|
|
<a name="l30"></a>
|
|
<a name="l31"></a></span><span class=cF1>F64</span><span class=cF0> Test(</span><span class=cF9>I64</span><span class=cF0> n, </span><span class=cF9>I64</span><span class=cF0> my_mp_count)
|
|
<a name="l32"></a>{
|
|
<a name="l33"></a> </span><span class=cF9>I64</span><span class=cF0> i, val = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l34"></a> </span><span class=cF1>F64</span><span class=cF0> </span><span class=cF1>start</span><span class=cF0>, </span><span class=cF1>end</span><span class=cF0>;
|
|
<a name="l35"></a>
|
|
<a name="l36"></a> </span><span class=cF1>start</span><span class=cF0> = </span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l37"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < SAMPLE_SIZE; i++)
|
|
<a name="l38"></a> val += Sum(n, my_mp_count);
|
|
<a name="l39"></a> </span><span class=cF1>end</span><span class=cF0> = </span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l40"></a> </span><span class=cF6>"Val:%,d\n"</span><span class=cF0>, val / SAMPLE_SIZE;
|
|
<a name="l41"></a> </span><span class=cF6>"$RED$N:%12,d Time:%10.8f$FG$\n"</span><span class=cF0>, n, (</span><span class=cF1>end</span><span class=cF0> - </span><span class=cF1>start</span><span class=cF0>) / SAMPLE_SIZE;
|
|
<a name="l42"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF1>end</span><span class=cF0> - </span><span class=cF1>start</span><span class=cF0>;
|
|
<a name="l43"></a>}
|
|
<a name="l44"></a>
|
|
<a name="l45"></a>#</span><span class=cF1>define</span><span class=cF0> VAL_MIN </span><span class=cFE>1000</span><span class=cF0>
|
|
<a name="l46"></a>#</span><span class=cF1>define</span><span class=cF0> TEST_MIN </span><span class=cFE>3</span><span class=cF0>
|
|
<a name="l47"></a>#</span><span class=cF1>define</span><span class=cF0> TEST_MAX </span><span class=cFE>7</span><span class=cF0>
|
|
<a name="l48"></a>#</span><span class=cF1>define</span><span class=cF0> TESTS_NUM (TEST_MAX - TEST_MIN + </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l49"></a>#</span><span class=cF1>define</span><span class=cF0> PERCENT_MAX </span><span class=cFE>200</span><span class=cF0>
|
|
<a name="l50"></a>
|
|
<a name="l51"></a></span><span class=cF1>U0</span><span class=cF0> MPAdd()
|
|
<a name="l52"></a>{
|
|
<a name="l53"></a> </span><span class=cF9>I64</span><span class=cF0> i, n,
|
|
<a name="l54"></a> h = </span><span class=cF5>Fs</span><span class=cF0>->pix_width,
|
|
<a name="l55"></a> v = </span><span class=cF5>Fs</span><span class=cF0>->pix_height;
|
|
<a name="l56"></a> </span><span class=cF1>F64</span><span class=cF0> t1, t2, ress[TESTS_NUM];
|
|
<a name="l57"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc = </span><span class=cF5>DCAlias</span><span class=cF0>;
|
|
<a name="l58"></a>
|
|
<a name="l59"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>, n = VAL_MIN; i < TESTS_NUM; i++, n *= </span><span class=cFE>10</span><span class=cF0>)
|
|
<a name="l60"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l61"></a> t1 = Test(n, </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l62"></a> t2 = Test(n, </span><span class=cFB>mp_count</span><span class=cF0>);
|
|
<a name="l63"></a> ress[i] = t2 * </span><span class=cFE>100</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> / t1;
|
|
<a name="l64"></a> </span><span class=cF6>"$GREEN$%8.4f%%$FG$\n\n"</span><span class=cF0>, ress[i];
|
|
<a name="l65"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l66"></a> </span><span class=cF5>PressAKey</span><span class=cF0>;
|
|
<a name="l67"></a>
|
|
<a name="l68"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l69"></a>
|
|
<a name="l70"></a> dc->color = </span><span class=cF3>BLUE</span><span class=cF0>;
|
|
<a name="l71"></a> </span><span class=cF1>for</span><span class=cF0> (i = PERCENT_MAX / </span><span class=cFE>10</span><span class=cF0>; i < PERCENT_MAX; i += PERCENT_MAX / </span><span class=cFE>10</span><span class=cF0>)
|
|
<a name="l72"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l73"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, v - </span><span class=cF5>ToF64</span><span class=cF7>(</span><span class=cF0>i</span><span class=cF7>)</span><span class=cF0> / PERCENT_MAX * v - </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>, </span><span class=cF6>"%3d%%"</span><span class=cF0>, i);
|
|
<a name="l74"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, v - </span><span class=cF5>ToF64</span><span class=cF7>(</span><span class=cF0>i</span><span class=cF7>)</span><span class=cF0> / PERCENT_MAX * v, h, v - </span><span class=cF5>ToF64</span><span class=cF7>(</span><span class=cF0>i</span><span class=cF7>)</span><span class=cF0> / PERCENT_MAX * v);
|
|
<a name="l75"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l76"></a>
|
|
<a name="l77"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < TESTS_NUM - </span><span class=cFE>1</span><span class=cF0>; i++)
|
|
<a name="l78"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l79"></a> dc->color = </span><span class=cF3>RED</span><span class=cF0>;
|
|
<a name="l80"></a> dc->thick = </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l81"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, i * h / </span><span class=cF7>(</span><span class=cF0>TESTS_NUM - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>, v - ress[i] / PERCENT_MAX * v, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l82"></a> </span><span class=cF7>(</span><span class=cF0>i + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * h / </span><span class=cF7>(</span><span class=cF0>TESTS_NUM - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>, v - ress[i + </span><span class=cFE>1</span><span class=cF0>] / PERCENT_MAX * v, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l83"></a> dc->color = </span><span class=cF3>GREEN</span><span class=cF0>;
|
|
<a name="l84"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, i * h / </span><span class=cF7>(</span><span class=cF0>TESTS_NUM - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>, v - </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>, </span><span class=cF6>"10e%d"</span><span class=cF0>, i + TEST_MIN);
|
|
<a name="l85"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, i * h / </span><span class=cF7>(</span><span class=cF0>TESTS_NUM - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, i * h / </span><span class=cF7>(</span><span class=cF0>TESTS_NUM - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>, v);
|
|
<a name="l86"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l87"></a> </span><span class=cF5>PressAKey</span><span class=cF0>;
|
|
<a name="l88"></a>
|
|
<a name="l89"></a> </span><span class=cF5>DCFill</span><span class=cF0>;
|
|
<a name="l90"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
|
|
<a name="l91"></a>}
|
|
<a name="l92"></a>
|
|
<a name="l93"></a>MPAdd;
|
|
</span></pre></body>
|
|
</html>
|