看板 DFBSD_kernel 關於我們 聯絡資訊
--0022158df337949ffd049d1db904 Content-Type: text/plain; charset=ISO-8859-1 Hello, I am porting the iostat from FreeBSD. I have problem with the function devstat_compute_statistics() Here is how its used in FreeBSD ans I tried the compute_stats() in dragonfly but still need this equivalent to be correct So, please give me the correct usage of compute_stats similar to devstat_compute_statistics in the FreeBSD, here it is: if (devstat_compute_statistics <http://fxr.googlebit.com/ident?i=devstat_compute_statistics>(&cur <http://fxr.googlebit.com/ident?i=cur>.dinfo <http://fxr.googlebit.com/ident?i=dinfo>->devices <http://fxr.googlebit.com/ident?i=devices>[di <http://fxr.googlebit.com/ident?i=di>], &last <http://fxr.googlebit.com/ident?i=last>.dinfo <http://fxr.googlebit.com/ident?i=dinfo>->devices <http://fxr.googlebit.com/ident?i=devices>[di <http://fxr.googlebit.com/ident?i=di>], busy_seconds, DSM_KB_PER_TRANSFER, &kb_per_transfer, DSM_TRANSFERS_PER_SECOND, &transfers_per_second, DSM_MB_PER_SECOND, &mb_per_second, DSM_NONE) != 0) errx <http://fxr.googlebit.com/ident?i=errx>(1, *"%s"*, devstat_errbuf <http://fxr.googlebit.com/ident?i=devstat_errbuf>); Also, is it OK if we call getnumdevs() without any arguments (its similar to freebsd devstat_getdevs()). The FreeBSD uses: switch (devstat_getdevs <http://fxr.googlebit.com/ident?i=devstat_getdevs>(NULL <http://fxr.googlebit.com/ident?i=NULL>, &cur <http://fxr.googlebit.com/ident?i=cur>)) { case -1: errx <http://fxr.googlebit.com/ident?i=errx>(1, *"%s"*, devstat_errbuf <http://fxr.googlebit.com/ident?i=devstat_errbuf>); break; case 1: cmdiostat <http://fxr.googlebit.com/ident?i=cmdiostat>(*"refresh"*, NULL <http://fxr.googlebit.com/ident?i=NULL>); break; default: break; } I am still trying to remove some warnings and error. Will mail you if need more help. pratyush.kshirsagar (@ gmail.com) --0022158df337949ffd049d1db904 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello,<div>I am porting the iostat from FreeBSD.</div><div>I have problem w= ith the function devstat_compute_statistics()</div><div>Here is how its use= d in FreeBSD ans I tried the compute_stats() in dragonfly but still need th= is equivalent to be correct</div> <div>So, please give me the correct usage of compute_stats similar to devst= at_compute_statistics in=A0the FreeBSD, here it is:</div><div><meta http-eq= uiv=3D"content-type" content=3D"text/html; charset=3Dutf-8"><span class=3D"= Apple-style-span" style=3D"font-family: &#39;Times New Roman&#39;; "><pre> if (<a href=3D"http://fxr.googlebit.com/ident?i=3Ddevstat_compute_s= tatistics">devstat_compute_statistics</a>(&amp;<a href=3D"http://fxr.google= bit.com/ident?i=3Dcur">cur</a>.<a href=3D"http://fxr.googlebit.com/ident?i= =3Ddinfo">dinfo</a>-&gt;<a href=3D"http://fxr.googlebit.com/ident?i=3Ddevic= es">devices</a>[<a href=3D"http://fxr.googlebit.com/ident?i=3Ddi">di</a>], &amp;<a href=3D"http://fxr.googlebit.com/ident?i=3Dlast">last<= /a>.<a href=3D"http://fxr.googlebit.com/ident?i=3Ddinfo">dinfo</a>-&gt;<a h= ref=3D"http://fxr.googlebit.com/ident?i=3Ddevices">devices</a>[<a href=3D"h= ttp://fxr.googlebit.com/ident?i=3Ddi">di</a>], busy_seconds, DSM_KB_PER_TRANSFER, &amp;kb_per_transfer, DSM_TRANSFERS_PER_SECOND, &amp;transfers_per_second, DSM_MB_PER_SECOND, &amp;mb_per_second, DSM_NONE) !=3D 0) <a href=3D"http://fxr.googlebit.com/ident?i=3Derrx">errx</= a>(1, <i>&quot;%s&quot;</i>, <a href=3D"http://fxr.googlebit.com/ident?i=3D= devstat_errbuf">devstat_errbuf</a>);</pre><pre><br></pre><pre>Also, is it O= K if we call getnumdevs() without any arguments (its similar to freebsd dev= stat_getdevs()).</pre> <pre>The FreeBSD uses:</pre><pre><meta http-equiv=3D"content-type" content= =3D"text/html; charset=3Dutf-8"><span class=3D"Apple-style-span" style=3D"f= ont-family: &#39;Times New Roman&#39;; white-space: normal; "><pre>switch (= <a href=3D"http://fxr.googlebit.com/ident?i=3Ddevstat_getdevs">devstat_getd= evs</a>(<a href=3D"http://fxr.googlebit.com/ident?i=3DNULL">NULL</a>, &amp;= <a href=3D"http://fxr.googlebit.com/ident?i=3Dcur">cur</a>)) { case -1: <a href=3D"http://fxr.googlebit.com/ident?i=3Derrx">errx</a= >(1, <i>&quot;%s&quot;</i>, <a href=3D"http://fxr.googlebit.com/ident?i=3Dd= evstat_errbuf">devstat_errbuf</a>); break; case 1: <a href=3D"http://fxr.googlebit.com/ident?i=3Dcmdiostat">c= mdiostat</a>(<i>&quot;refresh&quot;</i>, <a href=3D"http://fxr.googlebit.co= m/ident?i=3DNULL">NULL</a>); break; default: break; }</pre><pre><br></pre><pre>I am still trying to remove some warnings and e= rror. Will mail you if need more help.</pre><pre><br></pre><pre>pratyush.ks= hirsagar (@ <a href=3D"http://gmail.com">gmail.com</a>)</pre><pre><br></pre= > </span></pre></span></div> --0022158df337949ffd049d1db904--