WINDOWS实现精确定时程序

深入理解并应用Windows多媒体定时器 Windows Multimedia API是一套专门为了满足多媒体应用开发而设计的编程接口,它允许开发者对音频、视频以及其他时间相关的信息进行精确的控制。该API设计理念是为了解决多媒体应用中时间敏感性和同步问题,使得音频和视频可以准确无误地在计算机上播放、捕获和处理。API的应用范围包括但不限于游戏开发、音频/视频播放器、多媒体数据的实时捕获和处理。例如,在游戏开发中,通过使用多媒体定时器,开发者可以控制游戏循环的更新频率,确保游戏运行流畅而不会出现卡顿现象。 阅读详情
一.原理及相关API
WINDOWS正确定时,不同的CPU频率可以指定同一时间间隔。
使用QueryPerformanceFrequency的API,指定每秒的频率。Q ueryPerformanceFrequencyFunction查询每秒的行为频率,这个频率在整个系统运行过程中不被改变。

The QueryPerformanceFrequency function retrieves thefrequency of the high-resolution performance counter, if oneexists. The frequency cannot change while the system isrunning.

Syntax

BOOL QueryPerformanceFrequency(      
    LARGE_INTEGER *lpFrequency);

Parameters

lpFrequency
[out] Pointer to a variable that receives thecurrent performance-counter frequency, in counts per second. If theinstalled hardware does not support a high-resolution performancecounter, this parameter can be zero.

Return Value

If the installed hardware supports a high-resolution performancecounter, the return value is nonzero.

If the function fails, the return value is zero. To get extendederror information, call GetLastError. Forexample, if the installed hardware does not support ahigh-resolution performance counter, the function fails.


Function Information

Minimum DLL Versionkernel32.dll
HeaderDeclared in Winbase.h, includeWindows.h
Import libraryKernel32.lib
Minimum operating systemsWindows 95, WindowsNT 3.1
UnicodeImplemented as Unicode version.

See Also

Timers Overview, QueryPerformanceCounter

 

QueryPerformanceCounter返回当前频率值。

二.代码例子

////////////////////////////////////////////////////////////////////

 

#include "CTimer.h"

//---------------------- default constructor------------------------------
//
//-------------------------------------------------------------------------
CTimer::CTimer(): m_FPS(0),
             m_TimeElapsed(0.0f),
             m_FrameTime(0),
             m_LastTime(0),
             m_PerfCountFreq(0)
{
 //how many ticks per sec do we get

//返回系统每秒频率
 QueryPerformanceFrequency( (LARGE_INTEGER*)&m_PerfCountFreq);
// m_TimeScale 为每频率占用的秒数
 m_TimeScale = 1.0f/m_PerfCountFreq;
}

//---------------------- constructor-------------------------------------
//
// use to specify FPS
//
//-------------------------------------------------------------------------
CTimer::CTimer(float fps): m_FPS(fps),
                    m_TimeElapsed(0.0f),
                    m_LastTime(0),
                    m_PerfCountFreq(0)
{

 //how many ticks per sec do we get

//返回系统每秒频率
 QueryPerformanceFrequency( (LARGE_INTEGER*)&m_PerfCountFreq);

 m_TimeScale = 1.0f/m_PerfCountFreq;

 //calculate ticks per frame

//m_FPS为你希望系统每秒多少频率

//m_FrameTime为你设定的每频率相当于系统实际多少频率.可理解为每频率多少时间
 m_FrameTime = (LONGLONG)(m_PerfCountFreq /m_FPS);
}


//------------------------Start()-----------------------------------------
//
// call this immediately prior to game loop.Starts the timer (obviously!)
//启动定时器
//--------------------------------------------------------------------------
void CTimer::Start()
{
 //get the time
 QueryPerformanceCounter( (LARGE_INTEGER*)&m_LastTime);

 //update time to render next frame

//m_LastTime为定时开始前的时间

// m_NextTime为下次定时到了的时间.
 m_NextTime = m_LastTime + m_FrameTime;

 return;
}

//-------------------------ReadyForNextFrame()-------------------------------
//
// returns true if it is time to move on to thenext frame step. To be used if
// FPS is set.
//检测定时是否已经到了
//----------------------------------------------------------------------------
bool CTimer::ReadyForNextFrame()
{
 if (!m_FPS)
  {
   MessageBox(NULL, "No FPS set in timer", "Doh!", 0);

    returnfalse;
  }
 
  QueryPerformanceCounter( (LARGE_INTEGER*)&m_CurrentTime);

 if (m_CurrentTime >m_NextTime)
 {//定时到了

//  m_TimeElapsed为本次定时用了多少秒

//更新定时开始前的时间 m_LastTime 

  m_TimeElapsed =(m_CurrentTime - m_LastTime) * m_TimeScale;
  m_LastTime  =m_CurrentTime;

  //update time to render nextframe
  m_NextTime = m_CurrentTime +m_FrameTime;

  return true;
 }

 return false;
}

//--------------------------- TimeElapsed--------------------------------
//
// returns time elapsed since last call to thisfunction. Use in main
// when calculations are to be based on dt.
//
//-------------------------------------------------------------------------
double CTimer::TimeElapsed()
{

//得到本次定时已经用了多少秒
 QueryPerformanceCounter( (LARGE_INTEGER*)&m_CurrentTime);
 
 m_TimeElapsed = (m_CurrentTime -m_LastTime) * m_TimeScale;
 
 m_LastTime  =m_CurrentTime;

 return m_TimeElapsed;
  
}

 

 

========================================================================================

/////////////////////////////////////

///////////////////////////////////////

///////////////////////////////////////

 

#ifndef CTIMER_H
#define CTIMER_H
//-----------------------------------------------------------------------
//
//  Name: CTimer.h
//
//  Author: Mat Buckland 2002
//
// Desc: Windows timer class for the book GameAI
//  Programming with Neural Nets and GeneticAlgorithms.
//
//-----------------------------------------------------------------------

#include


class CTimer
{

private:

 LONGLONG m_CurrentTime,
          m_LastTime,
       m_NextTime,
       m_FrameTime,
       m_PerfCountFreq;

 double  m_TimeElapsed,
       m_TimeScale;

 float   m_FPS;


public:

  //ctors
 CTimer();
 CTimer(float fps);


 //whatdayaknow, this starts the timer
 void  Start();

 //determines if enough time has passed to moveonto next frame
 bool  ReadyForNextFrame();

 //only use this after a call to theabove.
 double GetTimeElapsed(){returnm_TimeElapsed;}

 double TimeElapsed();

};

 

#endif

 

三.使用举例


int WINAPI WinMain (HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR    szCmdLine,
                   int      iCmdShow)
{
    //handle to our window
  HWND      hWnd;
   
   //our window classstructure
  WNDCLASSEX    winclass;
  
    // first fill in the window class stucture
   winclass.cbSize       = sizeof(WNDCLASSEX);
   winclass.style        = CS_HREDRAW | CS_VREDRAW;
    winclass.lpfnWndProc   =WindowProc;
    winclass.cbClsExtra   = 0;
    winclass.cbWndExtra   = 0;
    winclass.hInstance    = hInstance;
    winclass.hIcon        = LoadIcon(NULL, IDI_APPLICATION);
    winclass.hCursor      = LoadCursor(NULL, IDC_ARROW);
    winclass.hbrBackground = NULL;
    winclass.lpszMenuName  = NULL;
    winclass.lpszClassName = g_szWindowClassName;
   winclass.hIconSm      = LoadIcon(NULL, IDI_APPLICATION);

   //register the windowclass
  if(!RegisterClassEx(&winclass))
  {
   MessageBox(NULL,"Registration Failed!", "Error", 0);

   //exit theapplication
   return0;
  }

   //create the window andassign its ID tohwnd   
    hWnd = CreateWindowEx(NULL,                // extended style
                           g_szWindowClassName,  // window class name
                           g_szApplicationName,  // window caption
                           WS_OVERLAPPEDWINDOW,  // window style
                           0,                   // initial x position
                           0,                   // initial y position
                           WINDOW_WIDTH,        // initial x size
                           WINDOW_HEIGHT,       // initial y size
                           NULL,                // parent window handle
                           NULL,                // window menu handle
                           hInstance,           // program instance handle
                           NULL);               // creation parameters

    //make sure the window creation has gone OK
    if(!hWnd)
    {
      MessageBox(NULL, "CreateWindowEx Failed!", "Error!", 0);
    }
        
    //make the window visible
   ShowWindow (hWnd,iCmdShow);
    UpdateWindow (hWnd);

    // Enterthe message loop
    bool bDone =false;

    //create a timer
   CTimertimer(FRAMES_PER_SECOND);

   //start the timer
   timer.Start();

    MSG msg;

   while(!bDone)
    {
     
    while(PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
    {
    if( msg.message == WM_QUIT )
    {
     // Stop loop if it's a quit message
     bDone = true;
    }

    else
    {
     TranslateMessage( &msg );
     DispatchMessage( &msg );
    }
    }

  if(timer.ReadyForNextFrame())
  {
    //**any gameupdate code goes in here**
     
     //this will call WM_PAINT which will render our scene
   InvalidateRect(hWnd,NULL, TRUE);
   UpdateWindow(hWnd);
    }
       
    }//endwhile

    UnregisterClass( g_szWindowClassName, winclass.hInstance );

    return msg.wParam;
}

OpenMVS :用 colmap制作自己的数据集 重建(用colmap计算位姿,将位姿转为MVS需要的格式) 数据集制作主要是在windows进行,比较方便。 阅读详情

相关推荐

07群晖Docker部署nousresearch/hermes-agent

群晖Docker部署nousresearch/hermes-agent。

分享技术,传播知识! 1391

Windows实现高精度定时器的三种方法

前段时间一个项目需要用到1/24s的高精度定时器,每秒的误差不能超过10ms,大约41.666666666毫秒的延时,普通Sleep肯定是没办法满足的了,可以用以下新的三种方法: /* // 1秒=1000毫秒(ms) // 1毫秒=1/1000秒(s) // 1秒=1000000 微秒(μs) // 1微秒=1/1000000秒(s) // 1秒=1000000000 ...

Koma的主页 3万+

[深度学习] 从 originbot 到 origincar

原来,OriginBot的摄像头是MIPI模式,而OriginCar的摄像头是USB摄像头,也就是imageWidth 是0~959,超过了范围640。origincar在执行以下命令部署模型时。

chdlr的博客 2386

windows下精确定时总结

windows下精确定时总结本文对Windows平台下常用的计时函数进行总结,包括精度为秒、毫秒、微秒三种精度的5种方法。分为在标准C/C++下的二种time()及clock(),标准C/C++所以使用的time()及clock()不仅可以用在Windows系统,也可以用于Linux系统。在Windows系统下三种,使用Windows提供的API接口timeGetTime()、GetTickCoun

qu710458643的博客 3144

RM机器人麦轮底盘实战:从零搭建到PID调参全记录(附避坑指南)

本文详细记录了RM机器人麦轮底盘从零搭建到PID调参的全过程,涵盖硬件组装、开发环境搭建、底盘解算和PID调参等关键步骤,并附有实用的避坑指南。特别针对麦轮控制、底盘解算和电机调试等核心问题提供了专业解决方案,帮助开发者快速提升机器人性能。

bush的博客 379

基于ST32 DAC7311数模转换器驱动代码及电路设计完整版

基于ST32的DAC7311模数转换器的电路设计及驱动代码完整版

qq_39626643的博客 3721

Windows中的精度定时问题

Windows中的精度定时问题   在Windows中,可以使用不同精度的定时器来满足不同的要求: 1、使用Timer组件   它其实是先调用SetTimer()函数建立一个定时器,然后每隔一定的时间向Windows发送一个WM_TIMER的消息,操作系统捕获此消息后处理相应的事件。但是由于Windows的定时器是建立在DOS的1CH的中断基础上的,而此中断的响应频率是每秒18.2次,所以T

moshang005的专栏 4250

微信8.0所有URL Scheme大全:隐藏入口与使用场景详解 内附195条微信URL Scheme

URL Scheme 类似于一个协议地址,它的作用和网页的https://差不多,只不过它不是打开网页,而是直接跳转到微信App内部的功能页面。→ 打开微信扫一扫→ 打开零钱通详情→ 打开微信面对面支付微信功能的“快捷指令”。整理下来,微信的 URL Scheme 基本覆盖了支付、联系人、扫一扫、小程序、运动设备等多个入口。对开发者来说,这些 Scheme 就像是隐藏的快捷通道,在某些场景(比如支付唤起、活动红包、客服入口)能大大简化流程。微信对外部调用限制非常严格。

代码简单说 Vue、JAVA、PHP、Node.js 熟练运用,接口、架构、性能全搞定。 2205

Windows精确定时(ms)

最近想模拟个波形发生器,查阅了一下windows的精确定时能力. 精确定时的用途基本上分为两种:延时;定时. 支配性参数--Timer Resolution 操作系统任务切换有时间片的概念,即每到达一个时间片 系统就可以调度一次,来完成任务切换及多个线程的分时复用; 该时间片也就是操作系统运行时的时间分辨率:该值并不固定,可以通过timeGetDevCaps来获取,得到的时间片是毫秒(m...

weixin_30407613的博客 902

【WRF数据准备】气象驱动数据-ERA5再分析数据(Copernicus)

【WRF数据准备】气象驱动数据-ERA5再分析数据

WW、forever的博客 5536

探秘RK3588:OverlayFS挂载与固件升级全攻略

本文围绕RK3588芯片的OverlayFS文件系统挂载与固件升级技术展开详细阐述。首先介绍了RK3588芯片的卓越性能及其在嵌入式领域的广泛应用,重点分析了OverlayFS文件系统的分层架构原理及其在RK3588设备上的挂载方法,包括详细的挂载步骤、常见问题解决方案。随后详细阐述了RK3588设备在Windows和Linux环境下的固件升级方案,涵盖升级准备、具体操作流程及故障处理等内容。最后通过智能安防监控设备的实际案例,展示了OverlayFS挂载与固件升级技术的应用效果。文章为嵌入式开发者提供了全

远程部署调试 运行安装 项目调试 二次开发 项目技术新 持续迭代 部分源码免费分享 287

Windows下的高精度定时器实现及精确时刻获取

    通讯、VOIP、视频等领域的很多核心技术对时间精度的要求非常高,比如数据采集、时间同步、媒体流平滑控制、拥塞算法等等,很多技术都是以毫秒为单位来进行计算和控制的。但是Windows设计之初并不是以实时系统为目标的,所以Windows系统的时间精度一直不高,实际最小单位是15ms左右,导致的结果就是所有Windows的时间、线程相关的操作都无法以1ms来实现精确控制。受影响的操作包括Sleep、GetTickCount、_ftime等等。比如你调用Sleep(2),期待2ms之后线程自动唤醒,但是实际

Akumas Lab 1万+

YOLO11 Backbone改进:二值化、三值化权重实战(一)

本文介绍了二值化/三值化神经网络的基本概念、优势挑战及应用场景。二值化网络将权重限制为±1,三值化则增加0值,显著减少模型存储需求和计算复杂度。虽然存在精度下降等挑战,但通过技术改进已能在移动设备、自动驾驶等领域应用。文章分析了YOLO11中适合量化的层,并详细阐述了二值化权重原理及Straight-Through Estimator等关键技术。二值化/三值化神经网络为资源受限设备提供了高效的深度学习解决方案。

本博客聚焦 YOLOv11 全流程落地,涵盖架构优化、数据集处理、训练技巧与多场景部署,兼及国产数据库、Java 开发与 AI 模型应用,内容兼顾理论与工程实践,为开发者提供系统干货,助力高效提升技术能力。 299

关于精确控制FPS的程序框架

本文转自:http://www.thecodeway.com/blog/?p=473 经常看到有人讨论如何在主循环中控制帧速的问题,很多人使用Sleep之类的函数,其实Sleep本身虽然能释放CPU,但无法做到精确控制FPS的值,这里介绍一种比较巧妙的框架,对FPS可以做到比较精确的控制,而且也不会占用CPU。这个框架用到了两个比较关键的函数:    timeSetEvent,调用这个函数后,操作系统创建了一个后台线程,这个线程由winmm.dll控制,按照指定的频率执行指定某函数或者将某个信号设置为“有信

狂人山庄 1948

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

c#实现程序每日定时执行的一种思路

c#实现程序每日定时执行

capsclock的博客 4924

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

利用控制台下定时器定时关机代码示例

定时关机,用srvany安装成服务使用。示例代码工程,基于vs2010/Files/alantop/shutoff.rar //shutoff.cpp:定义控制台应用程序的入口点。//#include"stdafx.h"#include<atltime.h>#include<windows.h>#include<stdio.h>#i...

测试 367

【D3D11游戏编程】学习笔记六:定时器的实现

(注:【D3D11游戏编程】学习笔记系列由优快云作者BonChoix所写,转载请注明出处:http://blog.youkuaiyun.com/BonChoix,谢谢~)          无论在游戏还是简单的动画程序当中,定时器是一个必不可少的元素,用来正确地控制游戏帧数、动画的播放。最简单的实现定时器的方法通过在主循环中定义两个静态计时用的变量即可实现。但在学习过程中,定时器的使用相当频繁,因此设计

BonChoix的专栏 8480

精确获取时间(QueryPerformanceCounter)

原文地址:http://blog.youkuaiyun.com/lsmdiao0812/article/details/3173374 LARGE_INTEGER tima,timb;  QueryPerformanceCounter(&tima); 在 Windows Server 2003 和 WindowsXP 中使用 QueryPerformanceCounter 函数的程序可能执行不当

OpenGL&game 833

基于Delphi的定时关机程序设计与实现

本文介绍了一个使用Delphi开发的定时关机工具,详细展示了其界面布局、控件配置及核心功能逻辑。通过可视化组件如时间选择器和单选按钮,用户可灵活设置关机时间或倒计时,程序再调用系统命令完成关机操作,体现了实用的小型桌面应用开发思路。

weixin_36238982的博客 674

CreateWaitableTimer和SetWaitableTimer函数(定时器)

用户感觉到软件的好用,就是可以定时地做一些工作,而不需要人参与进去。比如每天定时地升级病毒库,定时地下载电影,定时地更新游戏里的人物。要想 实现这些功能,就可以使用定时器的API函数CreateWaitableTimer和SetWaitableTimer来实现了,这对API函数创建的 时钟是比较精确的,可以达到100倍的10亿分之一秒。 函数CreateWaitableTim...

diaoqu4574的博客 559

C#中实现计时器功能(定时任务和计时多长时间后执行某方法)

场景 在低液位预警弹窗点击确定后需要实现一个计时器,比如在五分钟后再执行监控。 实现思路是使用Timer然后每秒执行一个方法,在方法中对秒数进行减1操作,等倒计时结束后执行相应的操作。 注: 博客主页:https://blog.youkuaiyun.com/badao_liumang_qizhi 关注公众号 霸道的程序猿 获取编程相关电子书、教程推送与免费下载 实现 但是Timer有三个 1.定义在System.Windows.Forms里 2.定义在System.Threading.Timer类里...

ba_wang_mao的专栏 6353

XP的定时关机命令?

Windows XP的关机是由Shutdown.exe程序来控制的,位于Windows/System32文件夹中。如 果想让Windows 2000也实现相同的效果,能够把Shutdown.exe拷贝到系统文件夹下。 比方你的电脑要在22:00关机,能够选择“開始→执行”,输入“at 22:00 Shutdown -s”, 这样,到了22点电脑就会出现“系统关机”对话框,默认有30秒钟的倒计时...

weixin_33777877的博客 92

Windows API - Timer Function , SetTimer和KillTimer函数

在前面介绍了一对定时器的API函数使用,现在又介绍另外一对API函数的使用。它使用起来比前的函数要简单一些,但它一般是使用到有窗口的程序里,并且它的精度也没有前面的API函数高,对于一些要求不高的场合还是非常合适的。它是采用消息通知的方式,每当定时到了就会收到一条消息。

_Max 1015

C#中3个定时器(timer)

1.定义在System.Windows.Forms 2.定义在System.Threading.Timer 3.定义在System.Timers.Timer

Hello World 2082
上一篇: 在windows下安装和使用gcc for win
下一篇: WIN网络编程-IOCP服务程序设计注意事项
deepfuture
博客等级 码龄17年 211粉丝 1287原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值