Re: [PATCH] i386: fix TSC clock source calibration error

2007-10-19 Thread Charles R Harris
On Tue, 2007-10-16 at 10:50 -0400, Dave Johnson wrote:
>
>  range of tsc_khz  # of boots  % of boots
> -  --  --
> < 1999750   0  0.000%
> 1999750 - 1999800  21  3.048%
> 1999800 - 1999850 166 24.128%
> 1999850 - 100 241 35.029%
> 100 - 150 211 30.669%
> 150 - 200  42  6.105%
> 200 - 200   0  0.000%
> 250 - 2000100   0  0.000%
>[...]
> 2000100 - 2015000   1  0.145%  << BAD
> 2015000 - 203   6  0.872%  << BAD
> 203 - 2045000   1  0.145%  << BAD
> 2045000 <   0  0.000%
>
> The worst boot was 2032.577 Mhz, over 1.5% off!

This may be related to bug
https://bugzilla.redhat.com/show_bug.cgi?id=270321 at Redhat bugzilla.
It has been easily reproducible on my machine.

Chuck
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] i386: fix TSC clock source calibration error

2007-10-19 Thread Charles R Harris
On Tue, 2007-10-16 at 10:50 -0400, Dave Johnson wrote:

  range of tsc_khz  # of boots  % of boots
 -  --  --
  1999750   0  0.000%
 1999750 - 1999800  21  3.048%
 1999800 - 1999850 166 24.128%
 1999850 - 100 241 35.029%
 100 - 150 211 30.669%
 150 - 200  42  6.105%
 200 - 200   0  0.000%
 250 - 2000100   0  0.000%
[...]
 2000100 - 2015000   1  0.145%   BAD
 2015000 - 203   6  0.872%   BAD
 203 - 2045000   1  0.145%   BAD
 20450000  0.000%

 The worst boot was 2032.577 Mhz, over 1.5% off!

This may be related to bug
https://bugzilla.redhat.com/show_bug.cgi?id=270321 at Redhat bugzilla.
It has been easily reproducible on my machine.

Chuck
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 1/13] Qsort

2005-01-23 Thread Charles R Harris
Here are semi-templated versions of quicksort and heapsort, just for
completeness. The quicksort uses the median of three.

Chuck

void  quicksort0( *pl,  *pr)
{
 vp, SWAP_temp;
 *stack[100], **sptr = stack, *pm, *pi, *pj, *pt;

for(;;) {
while ((pr - pl) > 15) {
/* quicksort partition */
pm = pl + ((pr - pl) >> 1);
if ((*pm,*pl)) SWAP(*pm,*pl);
if ((*pr,*pm)) SWAP(*pr,*pm);
if ((*pm,*pl)) SWAP(*pm,*pl);
vp = *pm;
pi = pl;
pj = pr - 1;
SWAP(*pm,*pj);
for(;;) {
do ++pi; while ((*pi,vp));
do --pj; while ((vp,*pj));
if (pi >= pj)  break;
SWAP(*pi,*pj);
}
SWAP(*pi,*(pr-1));
/* push largest partition on stack */
if (pi - pl < pr - pi) {
*sptr++ = pi + 1;
*sptr++ = pr;
pr = pi - 1;
}else{
*sptr++ = pl;
*sptr++ = pi - 1;
pl = pi + 1;
}
}
/* insertion sort */
for(pi = pl + 1; pi <= pr; ++pi) {
vp = *pi;
for(pj = pi, pt = pi - 1; pj > pl && (vp, 
*pt);) {
*pj-- = *pt--;
}
*pj = vp;
}
if (sptr == stack) break;
pr = *(--sptr);
pl = *(--sptr);
}
}

void heapsort0( *a, long n)
{
 tmp;
long i,j,l;

/* The array needs to be offset by one for heapsort indexing */
a -= 1;

for (l = n>>1; l > 0; --l) {
tmp = a[l];
for (i = l, j = l<<1; j <= n;) {
if (j < n && (a[j], a[j+1])) 
j += 1;
if ((tmp, a[j])) {
a[i] = a[j];
i = j;
j += j;
}else
break;
}
a[i] = tmp;
} 

for (; n > 1;) {
tmp = a[n];
a[n] = a[1];
n -= 1;
for (i = 1, j = 2; j <= n;) {
if (j < n && (a[j], a[j+1]))
j++;
if ((tmp, a[j])) {
a[i] = a[j];
i = j;
j += j;
}else
break;
}
a[i] = tmp;
}
}



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 1/13] Qsort

2005-01-23 Thread Charles R Harris
Here are semi-templated versions of quicksort and heapsort, just for
completeness. The quicksort uses the median of three.

Chuck

void  quicksort0typename(typename *pl, typename *pr)
{
typename vp, SWAP_temp;
typename *stack[100], **sptr = stack, *pm, *pi, *pj, *pt;

for(;;) {
while ((pr - pl)  15) {
/* quicksort partition */
pm = pl + ((pr - pl)  1);
if (lessthan(*pm,*pl)) SWAP(*pm,*pl);
if (lessthan(*pr,*pm)) SWAP(*pr,*pm);
if (lessthan(*pm,*pl)) SWAP(*pm,*pl);
vp = *pm;
pi = pl;
pj = pr - 1;
SWAP(*pm,*pj);
for(;;) {
do ++pi; while (lessthan(*pi,vp));
do --pj; while (lessthan(vp,*pj));
if (pi = pj)  break;
SWAP(*pi,*pj);
}
SWAP(*pi,*(pr-1));
/* push largest partition on stack */
if (pi - pl  pr - pi) {
*sptr++ = pi + 1;
*sptr++ = pr;
pr = pi - 1;
}else{
*sptr++ = pl;
*sptr++ = pi - 1;
pl = pi + 1;
}
}
/* insertion sort */
for(pi = pl + 1; pi = pr; ++pi) {
vp = *pi;
for(pj = pi, pt = pi - 1; pj  pl  lessthan(vp, 
*pt);) {
*pj-- = *pt--;
}
*pj = vp;
}
if (sptr == stack) break;
pr = *(--sptr);
pl = *(--sptr);
}
}

void heapsort0typename(typename *a, long n)
{
typename tmp;
long i,j,l;

/* The array needs to be offset by one for heapsort indexing */
a -= 1;

for (l = n1; l  0; --l) {
tmp = a[l];
for (i = l, j = l1; j = n;) {
if (j  n  lessthan(a[j], a[j+1])) 
j += 1;
if (lessthan(tmp, a[j])) {
a[i] = a[j];
i = j;
j += j;
}else
break;
}
a[i] = tmp;
} 

for (; n  1;) {
tmp = a[n];
a[n] = a[1];
n -= 1;
for (i = 1, j = 2; j = n;) {
if (j  n  lessthan(a[j], a[j+1]))
j++;
if (lessthan(tmp, a[j])) {
a[i] = a[j];
i = j;
j += j;
}else
break;
}
a[i] = tmp;
}
}



-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/