AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 04.02.2013, 02:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
Axilicious:System.Diagnostics.StopWatch
Источник: http://www.ksaelen.be/wordpresses/dy...ics-stopwatch/
==============

I often see code that still uses the WinApi::GetTickCount method to measure an interval of time. And though there is nothing wrong with it, I wanted to show an alternative method : the StopWatch already known in .Net for quite some time.
The sample below show the usage of the stopwatch while I was testing something out with looping all of the tables in the system:
X++:
static void FetchTableNames_ModelElementTables(Args _args)
{
    SysModelElement element;
    SysModelElementType elementType;
    System.Collections.ArrayList tableNames = new System.Collections.ArrayList();
    System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
    int64 elapsed;
    ;
 
    stopWatch.Start();
 
    // The SysModelElementType table contains the element types and we need the recId for the next selection
    select firstonly RecId
    from elementType
    where elementType.Name == 'Table';
 
    // With the recId of the table element type, select all of the elements with that type (hence, select all of the tables)
    while select Name
    from element
    where element.ElementType == elementType.RecId
    {
        tableNames.Add(element.Name);
    }
 
    stopWatch.Stop();
 
    // Get the time it took
    elapsed = stopWatch.get_ElapsedMilliseconds();
 
    info(strFmt("Time taken: %1", elapsed));
}

Источник: http://www.ksaelen.be/wordpresses/dy...ics-stopwatch/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.

Последний раз редактировалось Poleax; 04.02.2013 в 09:29.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Trace Parser. Error: Incorrect or missing MOF file, import is not available. Poleax DAX: Администрирование 6 13.05.2011 10:43
Удаленная работа с CRM и расширеный поиск ASheff Dynamics CRM: Разработка 64 04.06.2010 17:44
Ошибка бизнес-процесса Tarasov E Dynamics CRM: Разработка 9 18.02.2010 14:02
Не публикуется бизнес-процес Soulcar Dynamics CRM: Администрирование 6 04.02.2010 19:35
Проблема с установкои Email Router на CRM 4 Kosta100 Dynamics CRM: Администрирование 1 22.02.2009 14:00

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 23:53.