Set p->p_switchtime to switchtime instead of to the current time in

fork_trampoline() if switchtime is valid.  This fixes not accounting
for the time between the previous context switch and and the current
time (when the forked child starts up here) in most cases - the time
is now counted in the child's runtime.  I think it actually fixes
all cases, and switchtime is always valid here, since there must have
been a context switch just before the forked child starts up.  Some
code should be removed if this is correct.  The check that switchtime
is valid sometimes gives a false negative because the check isn't
correct until the after the first context switch after the system
has been up for >= 1 second.
This commit is contained in:
Bruce Evans 1998-07-28 17:55:37 +00:00
parent aa839b4b07
commit e539380ea8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=37920
3 changed files with 33 additions and 3 deletions

View file

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: exception.s,v 1.52 1998/05/17 11:51:53 phk Exp $
* $Id: exception.s,v 1.53 1998/05/28 09:29:54 phk Exp $
*/
#include "npx.h"
@ -345,9 +345,19 @@ ENTRY(fork_trampoline)
call _spl0
movl _curproc,%eax
addl $P_SWITCHTIME,%eax
movl _switchtime,%ecx
testl %ecx,%ecx
jne 1f
/* XXX unreachable? */
pushl %eax
call _microuptime
popl %eax
jmp 2f
1:
movl %ecx,(%eax)
movl _switchtime+4,%edx
movl %edx,4(%eax)
2:
/*
* cpu_set_fork_handler intercepts this function call to

View file

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: exception.s,v 1.52 1998/05/17 11:51:53 phk Exp $
* $Id: exception.s,v 1.53 1998/05/28 09:29:54 phk Exp $
*/
#include "npx.h"
@ -345,9 +345,19 @@ ENTRY(fork_trampoline)
call _spl0
movl _curproc,%eax
addl $P_SWITCHTIME,%eax
movl _switchtime,%ecx
testl %ecx,%ecx
jne 1f
/* XXX unreachable? */
pushl %eax
call _microuptime
popl %eax
jmp 2f
1:
movl %ecx,(%eax)
movl _switchtime+4,%edx
movl %edx,4(%eax)
2:
/*
* cpu_set_fork_handler intercepts this function call to

View file

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: exception.s,v 1.52 1998/05/17 11:51:53 phk Exp $
* $Id: exception.s,v 1.53 1998/05/28 09:29:54 phk Exp $
*/
#include "npx.h"
@ -345,9 +345,19 @@ ENTRY(fork_trampoline)
call _spl0
movl _curproc,%eax
addl $P_SWITCHTIME,%eax
movl _switchtime,%ecx
testl %ecx,%ecx
jne 1f
/* XXX unreachable? */
pushl %eax
call _microuptime
popl %eax
jmp 2f
1:
movl %ecx,(%eax)
movl _switchtime+4,%edx
movl %edx,4(%eax)
2:
/*
* cpu_set_fork_handler intercepts this function call to