syscall_emul.hh (7720:65d338a8dba4) | syscall_emul.hh (7823:dac01f14f20f) |
---|---|
1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 349 unchanged lines hidden (view full) --- 358const unsigned seconds_since_epoch = 1000000000; 359 360/// Helper function to convert current elapsed time to seconds and 361/// microseconds. 362template <class T1, class T2> 363void 364getElapsedTime(T1 &sec, T2 &usec) 365{ | 1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 349 unchanged lines hidden (view full) --- 358const unsigned seconds_since_epoch = 1000000000; 359 360/// Helper function to convert current elapsed time to seconds and 361/// microseconds. 362template <class T1, class T2> 363void 364getElapsedTime(T1 &sec, T2 &usec) 365{ |
366 int elapsed_usecs = curTick / SimClock::Int::us; | 366 int elapsed_usecs = curTick() / SimClock::Int::us; |
367 sec = elapsed_usecs / one_million; 368 usec = elapsed_usecs % one_million; 369} 370 371////////////////////////////////////////////////////////////////////// 372// 373// The following emulation functions are generic, but need to be 374// templated to account for differences in types, constants, etc. --- 810 unchanged lines hidden (view full) --- 1185SyscallReturn 1186timesFunc(SyscallDesc *desc, int callnum, LiveProcess *process, 1187 ThreadContext *tc) 1188{ 1189 int index = 0; 1190 TypedBufferArg<typename OS::tms> bufp(process->getSyscallArg(tc, index)); 1191 1192 // Fill in the time structure (in clocks) | 367 sec = elapsed_usecs / one_million; 368 usec = elapsed_usecs % one_million; 369} 370 371////////////////////////////////////////////////////////////////////// 372// 373// The following emulation functions are generic, but need to be 374// templated to account for differences in types, constants, etc. --- 810 unchanged lines hidden (view full) --- 1185SyscallReturn 1186timesFunc(SyscallDesc *desc, int callnum, LiveProcess *process, 1187 ThreadContext *tc) 1188{ 1189 int index = 0; 1190 TypedBufferArg<typename OS::tms> bufp(process->getSyscallArg(tc, index)); 1191 1192 // Fill in the time structure (in clocks) |
1193 int64_t clocks = curTick * OS::M5_SC_CLK_TCK / SimClock::Int::s; | 1193 int64_t clocks = curTick() * OS::M5_SC_CLK_TCK / SimClock::Int::s; |
1194 bufp->tms_utime = clocks; 1195 bufp->tms_stime = 0; 1196 bufp->tms_cutime = 0; 1197 bufp->tms_cstime = 0; 1198 1199 // Convert to host endianness 1200 bufp->tms_utime = htog(bufp->tms_utime); 1201 --- 30 unchanged lines hidden --- | 1194 bufp->tms_utime = clocks; 1195 bufp->tms_stime = 0; 1196 bufp->tms_cutime = 0; 1197 bufp->tms_cstime = 0; 1198 1199 // Convert to host endianness 1200 bufp->tms_utime = htog(bufp->tms_utime); 1201 --- 30 unchanged lines hidden --- |