Click here to Skip to main content
16,004,828 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How do I remove thousand seperator. Pin
Cedric Moonen16-Apr-09 0:00
Cedric Moonen16-Apr-09 0:00 
GeneralRe: How do I remove thousand seperator. Pin
Stuart Dootson16-Apr-09 0:08
professionalStuart Dootson16-Apr-09 0:08 
Question[OT] Re: How do I remove thousand seperator. Pin
David Crow16-Apr-09 3:28
David Crow16-Apr-09 3:28 
AnswerRe: [OT] Re: How do I remove thousand seperator. Pin
Stuart Dootson16-Apr-09 3:32
professionalStuart Dootson16-Apr-09 3:32 
GeneralRe: How do I remove thousand seperator. Pin
cozyu16-Apr-09 16:03
cozyu16-Apr-09 16:03 
QuestionMeasure timing of functions Pin
dybs15-Apr-09 14:33
dybs15-Apr-09 14:33 
AnswerRe: Measure timing of functions Pin
Luc Pattyn15-Apr-09 14:52
sitebuilderLuc Pattyn15-Apr-09 14:52 
AnswerRe: Measure timing of functions Pin
Stuart Dootson15-Apr-09 15:33
professionalStuart Dootson15-Apr-09 15:33 
To add to Luc's answer - I've always used the high-resolution performance counter[^] to time my code. I've got a class that encapsulates the whole process in an RAII fashion - something like:

class CTimer
{
public:
   CTimer(std::string const& what) : what_(what) { QueryPerformanceFrequency((LARGE_INTEGER*)&freq_); begin_ = Now(); }
   ~CTimer() { end_ = Now(); ShowTime(end_ - begin_); }
private:
   __int64 Now()
   {
      __int64 now;
      QueryPerformanceCounter((LARGE_INTEGER*)&now);
      // Now divide now by freq_ to get seconds - I generally scale before the division to get microseconds or nanoseconds
      return the time you calculated;
   }
   void ShowTime(__int64 deltaTime) { std::cout << "Doing " << what_ << /* Display deltaTime nicely */ << std::endl; }
   __int64 begin_, end_;
   __int64 freq_;
   const std::string what_;
};
// in my code
   {
      CTimer t("some message");
      // Do something lengthy
   } // A message is displayed when t goes out of scope, showing the time taken over it's lifetime, whic is near enough the time for the lengthy bit


I've left out the involved bits (calculating time from QueryPerformanceCounter result and displaying the time nicely) as I don't have access to the code I wrote right at the moment.

Certainly don't use clock() - it's a milli-second timer.

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: Measure timing of functions Pin
dybs15-Apr-09 15:59
dybs15-Apr-09 15:59 
AnswerRe: Measure timing of functions Pin
Jijo.Raj15-Apr-09 22:37
Jijo.Raj15-Apr-09 22:37 
QuestionC++ function source code size Pin
Eureka_jim15-Apr-09 10:35
Eureka_jim15-Apr-09 10:35 
AnswerRe: C++ function source code size Pin
Stuart Dootson15-Apr-09 11:18
professionalStuart Dootson15-Apr-09 11:18 
GeneralRe: C++ function source code size Pin
Rolf Kristensen15-Apr-09 11:52
Rolf Kristensen15-Apr-09 11:52 
GeneralRe: C++ function source code size Pin
Stuart Dootson15-Apr-09 15:15
professionalStuart Dootson15-Apr-09 15:15 
GeneralRe: C++ function source code size Pin
Eureka_jim16-Apr-09 6:13
Eureka_jim16-Apr-09 6:13 
AnswerRe: C++ function source code size Pin
Rolf Kristensen15-Apr-09 11:50
Rolf Kristensen15-Apr-09 11:50 
QuestionActiveX Pin
siva45515-Apr-09 8:33
siva45515-Apr-09 8:33 
AnswerRe: ActiveX Pin
KarstenK16-Apr-09 4:35
mveKarstenK16-Apr-09 4:35 
QuestionSendMessage in VS 2008 Pin
CString(0xcccccccc)15-Apr-09 7:41
CString(0xcccccccc)15-Apr-09 7:41 
AnswerRe: SendMessage in VS 2008 Pin
Stuart Dootson15-Apr-09 9:43
professionalStuart Dootson15-Apr-09 9:43 
GeneralRe: SendMessage in VS 2008 Pin
CString(0xcccccccc)15-Apr-09 12:48
CString(0xcccccccc)15-Apr-09 12:48 
GeneralRe: SendMessage in VS 2008 Pin
Stuart Dootson15-Apr-09 15:33
professionalStuart Dootson15-Apr-09 15:33 
GeneralRe: SendMessage in VS 2008 Pin
CString(0xcccccccc)15-Apr-09 21:31
CString(0xcccccccc)15-Apr-09 21:31 
GeneralRe: SendMessage in VS 2008 Pin
Stuart Dootson15-Apr-09 22:30
professionalStuart Dootson15-Apr-09 22:30 
GeneralRe: SendMessage in VS 2008 Pin
CString(0xcccccccc)16-Apr-09 11:38
CString(0xcccccccc)16-Apr-09 11:38 

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.