void cputimes(){ FILE *fd; float user, sys, idle; char tUser[15], tSys[15]; fd = fopen("/proc/stat","r"); fscanf(fd,"cpu %f %*f %f %f", &user, &sys, &idle); formatSeconds(user/100, tUser); printf("<b>Tiempo de cpu (usuario):</b> %s\n",tUser); formatSeconds(sys/100, tSys); printf("<p><b>Tiempo de cpu (sistema):</b> %s</p>\n",tSys); fclose(fd); return; }
static void writeLogRecord (const char *record) { if (logFile) { lockStream(logFile); { TimeValue now; char buffer[0X20]; size_t length; unsigned int milliseconds; getCurrentTime(&now); length = formatSeconds(buffer, sizeof(buffer), "%Y-%m-%d@%H:%M:%S", now.seconds); milliseconds = now.nanoseconds / NSECS_PER_MSEC; fprintf(logFile, "%.*s.%03u ", (int)length, buffer, milliseconds); } { char name[0X40]; size_t length = formatThreadName(name, sizeof(name)); if (length) fprintf(logFile, "[%s] ", name); } fputs(record, logFile); fputc('\n', logFile); flushStream(logFile); unlockStream(logFile); } }
void uptime(){ FILE *fd; float time; char hms[18]; fd = fopen("/proc/uptime","r"); fscanf(fd, "%f", &time); formatSeconds(time, hms); printf("<p><b>Uptime:</b> %s</p> \n", hms); fclose(fd); return; }
static void writeLogRecord (const char *record) { if (logFile) { { TimeValue now; char buffer[0X20]; size_t length; unsigned int milliseconds; getCurrentTime(&now); length = formatSeconds(buffer, sizeof(buffer), "%Y-%m-%d@%H:%M:%S", now.seconds); milliseconds = now.nanoseconds / NSECS_PER_MSEC; fprintf(logFile, "%.*s.%03u ", (int)length, buffer, milliseconds); } fputs(record, logFile); fputc('\n', logFile); fflush(logFile); } }
// This will overwrite any extra information otherwise being displayed void LLAvatarListItem::setLastInteractionTime(U32 secs_since) { setExtraInformation(formatSeconds(secs_since)); }
void LLAvatarListItem::setLastInteractionTime(U32 secs_since) { mLastInteractionTime->setValue(formatSeconds(secs_since)); }
void dynamicsMovie(struct part *part) { struct xyz *averagePositions = (struct xyz *)allocate(sizeof(struct xyz) * part->num_atoms); struct xyz *oldPositions = (struct xyz *)allocate(sizeof(struct xyz) * part->num_atoms); struct xyz *newPositions = (struct xyz *)allocate(sizeof(struct xyz) * part->num_atoms); struct xyz *positions = (struct xyz *)allocate(sizeof(struct xyz) * part->num_atoms); struct xyz *force = (struct xyz *)allocate(sizeof(struct xyz) * part->num_atoms); struct xyz *tmp; int i; #ifndef WIN32 int timefailure = 0; struct timeval start; struct timeval end; double elapsedSeconds; char timebuffer[256]; #endif setThermalVelocities(part, Temperature); for (i = 0; i < part->num_atoms; i++) { vset(positions[i], part->positions[i]); vsub2(oldPositions[i], positions[i], part->velocities[i]); } #ifndef WIN32 // we should probably use times() to get user and system time // instead of wall time, but the clock ticks conversions appear to // be system dependant. if (gettimeofday(&start, NULL)) { timefailure = errno; errno = 0; } #endif if (TimeReversal) { dynamicsMovieRun(part, averagePositions, &oldPositions, &newPositions, &positions, force, 0, NumFrames/2); tmp = newPositions; newPositions = positions; positions = tmp; dynamicsMovieRun(part, averagePositions, &oldPositions, &newPositions, &positions, force, NumFrames/2, NumFrames); } else { dynamicsMovieRun(part, averagePositions, &oldPositions, &newPositions, &positions, force, 0, NumFrames); } #ifndef WIN32 if (gettimeofday(&end, NULL)) { timefailure = errno; } if (timefailure) { errno = timefailure; perror("gettimeofday"); errno = 0; } else { end.tv_sec -= start.tv_sec; end.tv_usec -= start.tv_usec; if (end.tv_usec < 0) { end.tv_sec--; end.tv_usec += 1000000; } elapsedSeconds = (double)end.tv_sec + (double)end.tv_usec / 1e6; write_traceline("# Duration: %s, %f sec/frame, %f sec/iteration\n", formatSeconds(elapsedSeconds, timebuffer), elapsedSeconds / (double)i, elapsedSeconds / (double)(i * IterPerFrame)); } #endif writeOutputTrailer(OutputFile, part, NumFrames); free(averagePositions); free(oldPositions); free(newPositions); free(positions); free(force); }