Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / C++ [игнор отключен] [закрыт для гостей] / Время работы функции / 3 сообщений из 3, страница 1 из 1
30.07.2007, 14:09:14
    #34692727
FullKettle
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Время работы функции
Есть функция в DLL, написанная в VC++, требуется написать функцию, которая будет выполнять вышеописанную функцию и возвращать её время выполнения. Приблизительно время около 13 мс.
Как это сделать?
Код: plaintext
1.
2.
3.
4.
5.
int GetTime{
  int StartTime = ....
  MyFunc;
  return .... - StartTime;

}
... - функция получения системного времени. Не подскажите, как она называется?
...
Рейтинг: 0 / 0
30.07.2007, 14:17:34
    #34692760
Время работы функции
FullKettleЕсть функция в DLL, написанная в VC++, требуется написать функцию, которая будет выполнять вышеописанную функцию и возвращать её время выполнения. Приблизительно время около 13 мс.
Как это сделать?
Код: plaintext
1.
2.
3.
4.
5.
int GetTime{
  int StartTime = ....
  MyFunc;
  return .... - StartTime;

}
... - функция получения системного времени. Не подскажите, как она называется?
MSDN Help
GetSystemTime
The GetSystemTime function retrieves the current system date and time. The system time is expressed in Coordinated Universal Time (UTC).

VOID GetSystemTime(
LPSYSTEMTIME lpSystemTime // system time
);
Parameters
lpSystemTime
[out] Pointer to a SYSTEMTIME structure to receive the current system date and time.
Return Values
This function does not return a value.

Remarks
MAPI: For more information, see Syntax and Limitations for Win32 Functions Useful in MAPI Development.

Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.

See Also
Time Overview, Time Functions, GetLocalTime, GetSystemTimeAdjustment, SetSystemTime, SYSTEMTIME

MSDN Help
SYSTEMTIME
The SYSTEMTIME structure represents a date and time using individual members for the month, day, year, weekday, hour, minute, second, and millisecond.

typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME;
Members
wYear
Specifies the current year.
wMonth
Specifies the current month; January = 1, February = 2, and so on.
wDayOfWeek
Specifies the current day of the week; Sunday = 0, Monday = 1, and so on.
wDay
Specifies the current day of the month.
wHour
Specifies the current hour.
wMinute
Specifies the current minute.
wSecond
Specifies the current second.
wMilliseconds
Specifies the current millisecond.
Remarks
It is not recommended that you add and subtract values from the SYSTEMTIME structure to obtain relative times. Instead, you should

Convert the SYSTEMTIME structure to a FILETIME structure.
Copy the resulting FILETIME structure to a ULARGE_INTEGER structure.
Use normal 64-bit arithmetic on the ULARGE_INTEGER value.
Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winbase.h; include Windows.h.

See Also
Time Overview, Time Structures, FILETIME, GetSystemTime, ULARGE_INTEGER, SetSystemTime
...
Рейтинг: 0 / 0
30.07.2007, 16:41:43
    #34693415
ErV
ErV
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Время работы функции
FullKettle wrote:

> ... - функция получения системного времени. Не подскажите, как она
> называется?
танцуй от GetTickCount или QueryPerformanceCounter.
Posted via ActualForum NNTP Server 1.4
...
Рейтинг: 0 / 0
Форумы / C++ [игнор отключен] [закрыт для гостей] / Время работы функции / 3 сообщений из 3, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]