mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 08:16:31 +00:00
2ea6956433
Restructure network stack to use new Interrupt methods instead of hard-coded IRQ numbers. Add line count update into build process. Add progress bars to HTML generation and DoDistro. Clear Network Log border_doc. Fix font chars. Clean up some lingering unconverted variable and directory names. Remove word-wrap DolDoc tag from Clementine bible because of CPU spikes.
140 lines
15 KiB
HTML
Executable file
140 lines
15 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.07">
|
|
<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=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Debugging/Profiler;Profiler;Cmd Line (Typically)/Profiler"</span><span class=cF0>
|
|
<a name="l2"></a>#</span><span class=cF1>help_file</span><span class=cF0> </span><span class=cF6>"::/Doc/Profiler"</span><span class=cF0>
|
|
<a name="l3"></a>
|
|
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>PF_ARRAY_COUNT</span><span class=cF0> </span><span class=cFE>0x100000</span><span class=cF0>
|
|
<a name="l5"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFB>pf_jiffy_start</span><span class=cF0>, </span><span class=cFB>pf_jiffy_end</span><span class=cF0>;
|
|
<a name="l6"></a></span><span class=cF9>I64</span><span class=cF0> *</span><span class=cFB>pf_array</span><span class=cF0> = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l7"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFB>pf_cpu</span><span class=cF0> = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l8"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFB>pf_buf_in_ptr</span><span class=cF0> = </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>pf_depth</span><span class=cF0>;
|
|
<a name="l9"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFB>pf_prof_active</span><span class=cF0> = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l10"></a>
|
|
<a name="l11"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ProfTimerInt</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task)
|
|
<a name="l12"></a>{</span><span class=cF2>//See </span><a href="https://tomawezome.github.io/ZealOS/Kernel/KInterrupts.CC.html#l37"><span class=cF4>profiler_timer_irq</span></a><span class=cF2>.</span><span class=cF0>
|
|
<a name="l13"></a> </span><span class=cF9>I64</span><span class=cF0> i, k;
|
|
<a name="l14"></a>
|
|
<a name="l15"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>pf_prof_active</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l16"></a> </span><span class=cF1>for</span><span class=cF0> (k = </span><span class=cFE>0</span><span class=cF0>; k <= </span><span class=cFB>pf_depth</span><span class=cF0>; k++)
|
|
<a name="l17"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l18"></a> </span><span class=cF1>if</span><span class=cF0> (task == </span><span class=cF5>Gs</span><span class=cF0>->idle_task)
|
|
<a name="l19"></a> i = </span><span class=cFD>SYS_IDLE_PT</span><span class=cF0>;
|
|
<a name="l20"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l21"></a> i = </span><span class=cF5>TaskCaller</span><span class=cF0>(task, k, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l22"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>pf_buf_in_ptr</span><span class=cF0> < </span><span class=cF3>PF_ARRAY_COUNT</span><span class=cF0>)
|
|
<a name="l23"></a> {
|
|
<a name="l24"></a> </span><span class=cFB>pf_array</span><span class=cF0>[</span><span class=cFB>pf_buf_in_ptr</span><span class=cF0>++] = i;
|
|
<a name="l25"></a> </span><span class=cFB>pf_jiffy_end</span><span class=cF0> = </span><span class=cFB>counts</span><span class=cF0>.jiffies;
|
|
<a name="l26"></a> }
|
|
<a name="l27"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l28"></a>}
|
|
<a name="l29"></a>
|
|
<a name="l30"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>Prof</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> depth=</span><span class=cFE>0</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> cpu_num=</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l31"></a>{</span><span class=cF2>/*Start collecting profiler statistics.</span><span class=cF0>
|
|
<a name="l32"></a></span><span class=cF2>Profilers report where time is spent</span><span class=cF0>
|
|
<a name="l33"></a></span><span class=cF2>by sampling RIP during the 1000Hz</span><span class=cF0>
|
|
<a name="l34"></a></span><span class=cF2>timer interrupt.</span><span class=cF0>
|
|
<a name="l35"></a>
|
|
<a name="l36"></a></span><span class=cF2>Do a </span><a href="https://tomawezome.github.io/ZealOS/System/Utils/Profiler.CC.html#l61"><span class=cF4>ProfRep</span></a><span class=cF2>(), (profiler report)</span><span class=cF0>
|
|
<a name="l37"></a></span><span class=cF2>after you have collected data.</span><span class=cF0>
|
|
<a name="l38"></a></span><span class=cF2>*/</span><span class=cF0>
|
|
<a name="l39"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cFE>0</span><span class=cF0> <= cpu_num < </span><span class=cFB>mp_count</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l40"></a> </span><span class=cF3>ST_ERR_ST</span><span class=cF0> </span><span class=cF6>"Invalid CPU\n"</span><span class=cF0>;
|
|
<a name="l41"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l42"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l43"></a> </span><span class=cFB>cpu_structs</span><span class=cF0>[</span><span class=cFB>pf_cpu</span><span class=cF0>].profiler_timer_irq = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l44"></a> </span><span class=cFB>pf_cpu</span><span class=cF0> = cpu_num;
|
|
<a name="l45"></a>
|
|
<a name="l46"></a> </span><span class=cFB>pf_depth</span><span class=cF0> = depth;
|
|
<a name="l47"></a> </span><span class=cFB>pf_buf_in_ptr</span><span class=cF0> = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l48"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFB>pf_array</span><span class=cF0>)
|
|
<a name="l49"></a> </span><span class=cFB>pf_array</span><span class=cF0> = </span><span class=cF5>SysMAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0> * </span><span class=cF3>PF_ARRAY_COUNT</span><span class=cF0>);
|
|
<a name="l50"></a> </span><span class=cFB>pf_jiffy_end</span><span class=cF0> = </span><span class=cFB>pf_jiffy_start</span><span class=cF0> = </span><span class=cFB>counts</span><span class=cF0>.jiffies;
|
|
<a name="l51"></a> </span><span class=cF5>LBts</span><span class=cF0>(&</span><span class=cFB>pf_prof_active</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l52"></a> </span><span class=cFB>cpu_structs</span><span class=cF0>[</span><span class=cFB>pf_cpu</span><span class=cF0>].profiler_timer_irq = &</span><span class=cF5>ProfTimerInt</span><span class=cF0>;
|
|
<a name="l53"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l54"></a>}
|
|
<a name="l55"></a>
|
|
<a name="l56"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ProfCompare</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *i1, </span><span class=cF1>U8</span><span class=cF0> *i2)
|
|
<a name="l57"></a>{
|
|
<a name="l58"></a> </span><span class=cF1>return</span><span class=cF0> i1 - i2;
|
|
<a name="l59"></a>}
|
|
<a name="l60"></a>
|
|
<a name="l61"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ProfRep</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> filter_count=</span><span class=cFE>1</span><span class=cF0>, </span><span class=cF1>Bool</span><span class=cF0> leave_it=</span><span class=cF3>OFF</span><span class=cF0>)
|
|
<a name="l62"></a>{</span><span class=cF2>//Profiler report. Call </span><a href="https://tomawezome.github.io/ZealOS/System/Utils/Profiler.CC.html#l30"><span class=cF4>Prof</span></a><span class=cF2>() first and collect data.</span><span class=cF0>
|
|
<a name="l63"></a> </span><span class=cF9>I64</span><span class=cF0> i, hits, rip, last_rip = </span><span class=cFE>0</span><span class=cF0>, routine_total = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l64"></a> </span><span class=cF1>F64</span><span class=cF0> total_time;
|
|
<a name="l65"></a> </span><span class=cF1>U8</span><span class=cF0> buf[</span><span class=cFE>256</span><span class=cF0>], buf2[</span><span class=cFE>256</span><span class=cF0>], last_buf[</span><span class=cFE>256</span><span class=cF0>];
|
|
<a name="l66"></a>
|
|
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>LBtr</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>pf_prof_active</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l68"></a> </span><span class=cF6>"Profiler Not Active\n"</span><span class=cF0>;
|
|
<a name="l69"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFB>pf_buf_in_ptr</span><span class=cF0>)
|
|
<a name="l70"></a> </span><span class=cF6>"No Profiler Statistic\n"</span><span class=cF0>;
|
|
<a name="l71"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l72"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l73"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>total_time = </span><span class=cFB>pf_jiffy_end</span><span class=cF0> - </span><span class=cFB>pf_jiffy_start</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l74"></a> total_time = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l75"></a> </span><span class=cF5>QuickSortI64</span><span class=cF0>(</span><span class=cFB>pf_array</span><span class=cF0>, </span><span class=cFB>pf_buf_in_ptr</span><span class=cF0>, &</span><span class=cF5>ProfCompare</span><span class=cF0>);
|
|
<a name="l76"></a> *last_buf = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l77"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFB>pf_buf_in_ptr</span><span class=cF0>; i += hits)
|
|
<a name="l78"></a> {
|
|
<a name="l79"></a> rip = </span><span class=cFB>pf_array</span><span class=cF0>[i];
|
|
<a name="l80"></a> hits = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l81"></a> </span><span class=cF1>do</span><span class=cF0> hits++;
|
|
<a name="l82"></a> </span><span class=cF1>while</span><span class=cF0> (i + hits < </span><span class=cFB>pf_buf_in_ptr</span><span class=cF0> && </span><span class=cFB>pf_array</span><span class=cF0>[i + hits] == rip);
|
|
<a name="l83"></a>
|
|
<a name="l84"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(buf, </span><span class=cF6>"%p"</span><span class=cF0>, rip);
|
|
<a name="l85"></a> </span><span class=cF5>StrFirstRemove</span><span class=cF0>(buf, </span><span class=cF6>"+"</span><span class=cF0>, buf2);
|
|
<a name="l86"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>buf2, last_buf</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l87"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l88"></a> </span><span class=cF1>if</span><span class=cF0> (*last_buf && routine_total >= filter_count)
|
|
<a name="l89"></a> </span><span class=cF6>"$GREEN$%6.2f %08X:%s\n$FG$"</span><span class=cF0>, </span><span class=cFE>100</span><span class=cF0> * routine_total / total_time, routine_total, last_buf;
|
|
<a name="l90"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(last_buf, buf2);
|
|
<a name="l91"></a> routine_total = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l92"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l93"></a> routine_total += hits;
|
|
<a name="l94"></a> </span><span class=cF1>if</span><span class=cF0> (hits >= filter_count)
|
|
<a name="l95"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l96"></a> </span><span class=cF6>"%6.2f %08X:%P\n"</span><span class=cF0>, </span><span class=cFE>100</span><span class=cF0> * hits / total_time, hits, rip;
|
|
<a name="l97"></a> last_rip=rip;
|
|
<a name="l98"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l99"></a> }
|
|
<a name="l100"></a> </span><span class=cF1>if</span><span class=cF0> (*last_buf && routine_total >= filter_count)
|
|
<a name="l101"></a> </span><span class=cF6>"$GREEN$%6.2f %08X:%s\n$FG$"</span><span class=cF0>, </span><span class=cFE>100</span><span class=cF0> * routine_total / total_time, routine_total, last_buf;
|
|
<a name="l102"></a> </span><span class=cF6>"Total Time:%0.6fs\n"</span><span class=cF0>, total_time / </span><span class=cF3>JIFFY_FREQ</span><span class=cF0>;
|
|
<a name="l103"></a> </span><span class=cF1>if</span><span class=cF0> (leave_it)
|
|
<a name="l104"></a> {
|
|
<a name="l105"></a> </span><span class=cFB>cpu_structs</span><span class=cF0>[</span><span class=cFB>pf_cpu</span><span class=cF0>].profiler_timer_irq = &</span><span class=cF5>ProfTimerInt</span><span class=cF0>;
|
|
<a name="l106"></a> </span><span class=cF5>LBts</span><span class=cF0>(&</span><span class=cFB>pf_prof_active</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l107"></a> }
|
|
<a name="l108"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l109"></a> </span><span class=cFB>cpu_structs</span><span class=cF0>[</span><span class=cFB>pf_cpu</span><span class=cF0>].profiler_timer_irq = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l110"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l111"></a>}
|
|
</span></pre></body>
|
|
</html>
|