Click here to Skip to main content
15,918,471 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionNamed Pipes 2-way commication Pin
dene9997018-Jul-10 13:23
dene9997018-Jul-10 13:23 
AnswerRe: Named Pipes 2-way commication Pin
Luc Pattyn18-Jul-10 14:12
sitebuilderLuc Pattyn18-Jul-10 14:12 
AnswerRe: Named Pipes 2-way commication Pin
Chuck O'Toole18-Jul-10 18:20
Chuck O'Toole18-Jul-10 18:20 
AnswerRe: Named Pipes 2-way commication Pin
ThatsAlok18-Jul-10 20:47
ThatsAlok18-Jul-10 20:47 
AnswerRe: Named Pipes 2-way commication Pin
Moak18-Jul-10 23:43
Moak18-Jul-10 23:43 
QuestionRadio Button's Satus?? Pin
AmbiguousName18-Jul-10 4:01
AmbiguousName18-Jul-10 4:01 
AnswerRe: Radio Button's Satus?? Pin
Maximilien18-Jul-10 4:09
Maximilien18-Jul-10 4:09 
AnswerRe: Radio Button's Satus?? Pin
rp_suman18-Jul-10 8:31
rp_suman18-Jul-10 8:31 
GeneralRe: Radio Button's Satus?? Pin
Maximilien18-Jul-10 14:38
Maximilien18-Jul-10 14:38 
GeneralRe: Radio Button's Satus?? Pin
Randor 18-Jul-10 15:40
professional Randor 18-Jul-10 15:40 
GeneralRe: Radio Button's Satus?? Pin
Richard MacCutchan18-Jul-10 22:16
mveRichard MacCutchan18-Jul-10 22:16 
GeneralRe: Radio Button's Satus?? Pin
Randor 19-Jul-10 6:21
professional Randor 19-Jul-10 6:21 
GeneralRe: Radio Button's Satus?? Pin
Richard MacCutchan19-Jul-10 7:40
mveRichard MacCutchan19-Jul-10 7:40 
QuestionRe: Radio Button's Satus?? Pin
Randor 19-Jul-10 8:14
professional Randor 19-Jul-10 8:14 
AnswerRe: Radio Button's Satus?? Pin
Richard MacCutchan19-Jul-10 22:12
mveRichard MacCutchan19-Jul-10 22:12 
GeneralRe: Radio Button's Satus?? Pin
Randor 20-Jul-10 6:00
professional Randor 20-Jul-10 6:00 
GeneralRe: Radio Button's Satus?? [modified] Pin
Richard MacCutchan20-Jul-10 7:13
mveRichard MacCutchan20-Jul-10 7:13 
GeneralRe: Radio Button's Satus?? Pin
Randor 20-Jul-10 7:53
professional Randor 20-Jul-10 7:53 
AnswerRe: Radio Button's Satus?? Pin
bolivar12319-Jul-10 8:50
bolivar12319-Jul-10 8:50 
Questionproblem in skipping line in csv format files Pin
naveed tahir17-Jul-10 11:41
naveed tahir17-Jul-10 11:41 
AnswerRe: problem in skipping line in csv format files Pin
«_Superman_»17-Jul-10 18:07
professional«_Superman_»17-Jul-10 18:07 
AnswerRe: problem in skipping line in csv format files Pin
Garth J Lancaster17-Jul-10 18:10
professionalGarth J Lancaster17-Jul-10 18:10 
Questionerror C2440 Pin
mdocvc17-Jul-10 8:22
mdocvc17-Jul-10 8:22 
AnswerRe: error C2440 Pin
Aescleal17-Jul-10 9:37
Aescleal17-Jul-10 9:37 
Questioncalculating bytes per second Pin
saiyuk6=717-Jul-10 7:46
saiyuk6=717-Jul-10 7:46 
My questions is, im trying to make a small benchmark and im not sure if i am correctly doing this.
I am using a high-resolution performance counter, ive placed it in bold

This uses MD5, which you can simply get it at http://www.evenbalance.com/downloads/pbmd5.cpp[^]

im not really sure if im getting the correct bytes per second

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include "md5.h"

#define MUL_BYTES 1024
#define MUL_KB (MUL_BYTES*1024)
#define MUL_MB (MUL_KB*1024)

void Benchmark_MD5(void)
{
   unsigned __int64 iPerf;
   unsigned __int64 iBaseTime;
   double dbFreq;

   unsigned char bzBuffer[] = {0x0a, 0x55, 0x23};
   unsigned __int64 iValue;

   MD5_CTX md5;
   int iPasses = 5000;

   QueryPerformanceFrequency((LARGE_INTEGER *)&iPerf);
   dbFreq = 1.0 / (double)iPerf;
   QueryPerformanceCounter((LARGE_INTEGER *)&iBaseTime);

   for (int i = 0; i < iPasses; i++) {
      MD5Init(&md5, 0);
      MD5Update(&md5, bzBuffer, 3);
      MD5Final(&md5);
   }

   //16 is for the length of the MD5 Digest added by the passes we tested
   //then divided by the Seconds it took to run

   QueryPerformanceCounter((LARGE_INTEGER *)&iValue);
   double seconds = ((double)(iValue - iBaseTime) * dbFreq);
   double bps = (double)((double)(16 + iPasses) / seconds);


   printf("DEBUG: [Passes = %d] %5.3f Byte/s\n", iPasses, bps);

   printf("RESULT:\t");
   if (bps < MUL_BYTES)
      printf(" %5.2f Bytes/sec\n", bps);
   else    if (bps < MUL_KB)
      printf(" %5.2f KB/sec\n", bps / 1024);
   else    if (bps < MUL_MB)
      printf(" %5.2f MB/sec\n", bps / 1024 / 1024);
   else
      printf(" %5.2f GB/sec\n", bps / 1024 / 1024 / 1024);
}

void main(void)
{
   Benchmark_MD5();
}

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.