Click here to Skip to main content
15,890,512 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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();
}

AnswerRe: calculating bytes per second Pin
Chris Losinger17-Jul-10 8:37
professionalChris Losinger17-Jul-10 8:37 
GeneralRe: calculating bytes per second Pin
saiyuk6=717-Jul-10 8:45
saiyuk6=717-Jul-10 8:45 
QuestionRe: calculating bytes per second Pin
David Crow19-Jul-10 5:46
David Crow19-Jul-10 5:46 
AnswerRe: calculating bytes per second [modified] Pin
saiyuk6=719-Jul-10 14:15
saiyuk6=719-Jul-10 14:15 
GeneralRe: calculating bytes per second Pin
David Crow20-Jul-10 2:22
David Crow20-Jul-10 2:22 
GeneralRe: calculating bytes per second [modified] Pin
saiyuk6=720-Jul-10 5:36
saiyuk6=720-Jul-10 5:36 
QuestionOutputDebugString in x64 Pin
Pascal Ganaye17-Jul-10 0:51
Pascal Ganaye17-Jul-10 0:51 
AnswerRe: OutputDebugString in x64 Pin
Rajesh R Subramanian17-Jul-10 8:06
professionalRajesh R Subramanian17-Jul-10 8:06 
Questionhow to know the downloaded data from the net for a PC Pin
Sakhalean16-Jul-10 23:25
Sakhalean16-Jul-10 23:25 
AnswerRe: how to know the downloaded data from the net for a PC Pin
Spawn@Melmac17-Jul-10 4:32
Spawn@Melmac17-Jul-10 4:32 
AnswerRe: how to know the downloaded data from the net for a PC Pin
Niklas L17-Jul-10 9:16
Niklas L17-Jul-10 9:16 
QuestionCompiling 64bit Pin
Fareed Rizkalla16-Jul-10 10:32
Fareed Rizkalla16-Jul-10 10:32 
AnswerRe: Compiling 64bit Pin
Emilio Garavaglia16-Jul-10 22:50
Emilio Garavaglia16-Jul-10 22:50 
AnswerRe: Compiling 64bit Pin
Richard MacCutchan16-Jul-10 23:00
mveRichard MacCutchan16-Jul-10 23:00 
Questionproper conversion of unsigned char [16] -> unsigned long [4] [modified] Pin
saiyuk6=716-Jul-10 8:45
saiyuk6=716-Jul-10 8:45 
AnswerRe: proper conversion of unsigned char [16] -> unsigned long [4] Pin
Chris Losinger16-Jul-10 9:14
professionalChris Losinger16-Jul-10 9:14 
GeneralRe: proper conversion of unsigned char [16] -> unsigned long [4] Pin
saiyuk6=716-Jul-10 9:28
saiyuk6=716-Jul-10 9:28 

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.