boost學習筆記(計時器)
timer
timer已經定義就開始計時,elapsed方法返回經歷的時間。timer能的計時是有限制的。elapsed_max方法可以顯示最長計時時間,elapsed_min方法顯示最短計時時間。restart方法表示重新開始計時。
#include <iostream>
#include <boost\timer.hpp>
using namespace boost;
using namespace std;
int main() {
timer t;
cout << "最大計時時間:" << t.elapsed_max() / 3600 << "小時" << endl;
cout << "最小計時時間:" << t.elapsed_min() << "秒" << endl;
cout << "當前耗時:" << t.elapsed() << "秒" << endl;
t.restart();
cout << "當前耗時:" << t.elapsed() << "秒" << endl;
return 0;
}
最大計時時間:596.523小時 最小計時時間:0.001秒 當前耗時:0.002秒 當前耗時:0秒
progress_timer
progress_timer擴充套件自timer,析構時自動列印消耗時間。
#include <iostream>
#include <boost\timer.hpp>
#include <boost\progress.hpp>
using namespace boost;
using namespace std;
int main() {
{
progress_timer pt;
int total = 0;
for (int i = 0;i <= 100;i++) {
total += i;
}
cout << total << endl;
}
return 0;
}
5050
0.00 s
progress_display
progress_display處理長時間的計時過程。可以限制處理的進度。
#include <iostream>
#include <boost\timer.hpp>
#include <boost\progress.hpp>
#include <Windows.h>
using namespace boost;
using namespace std;
int main() {
progress_display pd(100);
for (int i = 0;i < 100;i++) {
Sleep(100);
++pd;
}
return 0;
}
0% 10 20 30 40 50 60 70 80 90 100%
|----|----|----|----|----|----|----|----|----|----|
***************************************************
相關推薦
boost學習筆記(計時器)
timer timer已經定義就開始計時,elapsed方法返回經歷的時間。timer能的計時是有限制的。elapsed_max方法可以顯示最長計時時間,elapsed_min方法顯示最短計時時間。restart方法表示重新開始計時。 #include &l
Python學習筆記(十一)裝飾器
before 原來 return wrap 文本 wiki 模塊 http 學習筆記 摘抄:https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/0014318
Nodejs學習筆記(十一)—數據采集器示例(request和cheerio)
列表 意思 9.1 很多 AD 開發 com http undefined 寫在之前 很多人都有做數據采集的需求,用不同的語言,不同的方式都能實現,我以前也用C#寫過,主要還是發送各類請求和正則解析數據比較繁瑣些,總體來說沒啥不好的,就是效率要差一些, 用nodej
前端入門學習筆記(十四)CSS基礎(二)CSS 規則與選擇器
CSS語法 CSS是由瀏覽器解釋的樣式規則,然後應用於文件中相應的元素。 樣式規則有三個部分:選擇器,屬性和值。 例如,標題顏色可以定義為: h1{color: red;} 選擇器{ 屬性: 值;} selec
OpenCV學習筆記(十二)——隨機數產生器RNG
用OpenCV做演算法的朋友們肯定為隨機數煩惱過,新版本一直支援隨機數產生器啦,而且還繼續支援之前版本的c格式的函式,不過與時俱進,我這裡介紹C++的RNG類。它可以壓縮一個64位的i整數並可以得到scalar和array的隨機數。目前的版本支援均勻分佈隨機數和Gaussi
OpenCV學習筆記(三十三)——用haar特徵訓練自己的分類器(再做手勢檢測)
資料還是得看啊,又讀了經典文獻《Robust Real-Time Face Detection》,不願意讀原文的朋友可以看看http://blog.csdn.net/hqw7286/article/details/5556767,作者把文中的要點基本也都總結出來了。Ope
莫煩pytorch學習筆記(十一)——Optimizer優化器
建造第一個神經網路——Optimizer優化器 要點 這節內容主要是用 Torch 實踐,中起到的幾種優化器。 下圖就是這節內容對比各種優化器的效果: 偽資料 為了對比各種優化器的效果, 我們需要有一些資料, 今天我們還是自己編一些偽資料, 這批資料是這樣的
boost學習筆記(windows+vs2017+boost1.67 64位編譯)
環境:windows10+vs2017+boost1_67 64位 boost下載 安裝 執行boost_1_67_0-msvc-14.1-64.exe,選擇安裝目錄進行安裝 編譯 進入boost安裝目錄,執行bootstrap.bat,稍
模式識別學習筆記(十六)--非線性分類器
前面的學習中,我們學習了有關線性分類器的相關知識,但是要知道,很多情況下我們並不能保證類別間的分類面是線性的(線性是最簡單的情況),而且許多複雜問題中,可能採用非線性分類器更適合問題的解決;因此接下來開始,繼續學習有關非線性分類器的東西,必要時可以跟前面線性分類器進行一個總
Nodejs學習筆記(十一)--- 資料採集器示例(request和cheerio)
目錄 寫在之前 很多人都有做資料採集的需求,用不同的語言,不同的方式都能實現,我以前也用C#寫過,主要還是傳送各類請求和正則解析資料比較繁瑣些,總體來說沒啥不好的,就是效率要差一些, 用nodejs寫採集程式還是比較有效率(可能也只是相對C#來說),今天主要用一個示例來說一下使用node
微信小程式學習筆記(十四)slider滑動選擇器
show-value是否顯示預設值,它和value一起出現 step每步走的數 block-size滑動方塊大小 backgroundColor未滑動區域的顏色 activeColor滑動區域的顏色
模式識別(Pattern Recognition)學習筆記(十九)--多層感知器模型(MLP)
早前已經學習了感知器學習演算法,主要通過對那些錯分類的樣本進行求和來表示對錯分樣本的懲罰,但明顯的它是一個線性的判別函式;而且上節學到了感知器神經元(閾值邏輯單元),對於單個的感知器神經元來說,儘管它能夠實現線性可分資料的分類問題(如與、或問題),但是卻無法解
C#學習筆記(十六):索引器和重載運算符
instance cit png form mage 創建 return position args 二維數組如何映射到一維數組 重載運算符 1、算術運算符 2、關系運算符, < 和 > 成對重載 using System; using Sy
OpenCV2學習筆記(十五):利用Cmake高速查找OpenCV函數源代碼
one 生成 img log 分享 lan 學習筆記 全部 modules 在使用OpenCV時,在對一個函數的調用不是非常了解的情況下,通常希望查到該函數的官方聲明。而假設想進一步研究OpenCV的函數,則必須深入到源碼。在VS中我們能夠選中想要查
機器學習筆記(Washington University)- Regression Specialization-week five
ril ... des stl it is idg evaluate date lec 1. Feature selection Sometimes, we need to decrease the number of features Efficiency: With f
Pro Android學習筆記(一三七):Home Screen Widgets(3):配置Activity
map onclick widgets info xtra ces extends height appwidget 文章轉載僅僅能用於非商業性質,且不能帶有虛擬貨幣、積分、註冊等附加條件。轉載須註明出處http://blog.csdn.net/flowingfly
機器學習筆記(Washington University)- Regression Specialization-week six
lar fec space cti different only similar ant var 1. Fit locally If the true model changes much, we want to fit our function locally to di
機器學習筆記(Washington University)- Classification Specialization-week 3
read was lowest already start choose class sort pty 1. Quality metric Quality metric for the desicion tree is the classification error er
機器學習筆記(Washington University)- Classification Specialization-week six & week 7
ges only end label rod eas point for lar 1. Precisoin and recall precision is how precise i am at showing good stuff on my website recall
機器學習筆記(Washington University)- Clustering Specialization-week four
++ blog isp special specified ring all png mat 1. Probabilistic clustering model (k-means) Hard assignments do not tell the full story,