##############################################################################
Add the following code to gimp\app\core\gimp-utils.c:
##############################################################################


#ifdef G_OS_WIN32

/* define the time variables here and in gimp_utils.h

 the time variables simply hold 64-bit performance counter values - define as many as you need

 count variables can be used to count how many times a section of code has been called

 Initialise the time and count variables to be used to 0 before the code that is to be timed

 To time a section of code:

   gint64 time_x;

   count1++;            / * count the number of times this section of code is timed if req'd * /

   time_x = gimp_high_res_timer_now ();

   section of code to be timed

   time1 += gimp_high_res_timer_elapsed (time_x);

 At the appropriate point display the results using something like the following:

   gimp_tool_message(tool, display, "%i %Lu %Lu %Lu %Lu", count1, time1, time2, time3, time4);

 */

gint64 time1 = 0;
gint64 time2 = 0;
gint64 time3 = 0;
gint64 time4 = 0;
gint64 time5 = 0;
gint64 time6 = 0;
gint64 time7 = 0;
unsigned int count1 = 0;


static gboolean query_performance_intialised = FALSE;
typedef BOOL (WINAPI *t_QueryPerformanceCounter) (gint64 *lpPerformanceCount);
static t_QueryPerformanceCounter p_QueryPerformanceCounter;

/* Return the curent value of the performance counter */

gint64
gimp_high_res_timer_now (void)
{
  gint64  result;
  HMODULE kernel32;

  result = 0;

  if (query_performance_intialised == FALSE)
  {
    query_performance_intialised = TRUE;

    p_QueryPerformanceCounter = NULL;
    kernel32 = GetModuleHandle ("KERNEL32.DLL");
    if (kernel32 != NULL)
      p_QueryPerformanceCounter = (t_QueryPerformanceCounter) GetProcAddress (kernel32, "QueryPerformanceCounter");
  }

  if (p_QueryPerformanceCounter)
    p_QueryPerformanceCounter (&result);

  return result;
}

/* On entry:
      timer = a performance count value previously read using gimp_High_Res_Timer_Now()

   On exit:
      the function returns the difference between the supplied performance count and the
      current value */

gint64 gimp_high_res_timer_elapsed (gint64 timer)
{
  gint64 time_now;
  gint64 result;

  time_now = gimp_high_res_timer_now ();

  if (time_now < timer)
    result = LLONG_MAX - timer + time_now;
  else
    result = time_now - timer;
  return result;
}

#endif


##############################################################################
Add the following code to gimp\app\core\gimp-utils.h
##############################################################################

#ifdef G_OS_WIN32

extern gint64 time1;
extern gint64 time2;
extern gint64 time3;
extern gint64 time4;
extern gint64 time5;
extern gint64 time6;
extern gint64 time7;
extern unsigned int count1;


gint64       gimp_high_res_timer_now               (void);
gint64       gimp_high_res_timer_elapsed           (gint64 timer);
#endif

##############################################################################

For the purposes of timing the paint brush drawing:

Initialise time1 etc:

time1 = gimp_high_res_timer_now ();
time2 = 0;
etc

then in gimppainttool.c/gimp_paint_tool_button_release() add something like:

time1 = gimp_high_res_timer_elapsed (time1);	/* read time from button press to release  */

gimp_tool_message (tool, display, "%i %Lu %Lu %Lu %Lu %Lu %Lu %Lu", count1, time1, time2, time3, time4,
				 time5, time6, time7);
