~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/benchmark/benchmarkudf.cc

  • Committer: Stewart Smith
  • Date: 2010-02-05 01:20:18 UTC
  • mto: (1286.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1287.
  • Revision ID: stewart@flamingspork.com-20100205012018-blvmeky20wze8eyg
initial TableProtoTester engine. We can't just use table_write as some protobuf library versions don't let us write invalid protobuf messages :(

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
 
58
58
  char buff[MAX_FIELD_WIDTH];
59
59
  String tmp(buff,sizeof(buff), &my_charset_bin);
60
 
  type::Decimal tmp_decimal;
 
60
  my_decimal tmp_decimal;
61
61
  Session *session= current_session;
62
62
  uint64_t loop_count;
63
63
 
68
68
  {
69
69
    if (args[0]->null_value == false)
70
70
    {
71
 
      internal::int64_t10_to_str((int64_t)loop_count, buff, -10);
 
71
      int64_t10_to_str((int64_t)loop_count, buff, -10);
72
72
      push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
73
73
                          ER_WRONG_VALUE_FOR_TYPE, ER(ER_WRONG_VALUE_FOR_TYPE),
74
74
                          "count", buff, "benchmark");
81
81
  null_value= false;
82
82
 
83
83
  uint64_t loop;
84
 
  for (loop= 0 ; loop < loop_count && not session->getKilled(); loop++)
 
84
  for (loop= 0 ; loop < loop_count && !session->killed; loop++)
85
85
  {
86
86
    switch (args[1]->result_type()) 
87
87
    {
118
118
 
119
119
plugin::Create_function<BenchmarkFunction> *benchmarkudf= NULL;
120
120
 
121
 
static int initialize(module::Context &context)
 
121
static int initialize(plugin::Registry &registry)
122
122
{
123
123
  benchmarkudf= new plugin::Create_function<BenchmarkFunction>("benchmark");
124
 
  context.add(benchmarkudf);
 
124
  registry.add(benchmarkudf);
125
125
  return 0;
126
126
}
127
127
 
 
128
static int finalize(plugin::Registry &registry)
 
129
{
 
130
   registry.remove(benchmarkudf);
 
131
   delete benchmarkudf;
 
132
   return 0;
 
133
}
 
134
 
128
135
DRIZZLE_DECLARE_PLUGIN
129
136
{
130
137
  DRIZZLE_VERSION_ID,
134
141
  "Measure time for repeated calls to a function.",
135
142
  PLUGIN_LICENSE_GPL,
136
143
  initialize, /* Plugin Init */
137
 
  NULL,   /* depends */
 
144
  finalize,   /* Plugin Deinit */
 
145
  NULL,   /* status variables */
 
146
  NULL,   /* system variables */
138
147
  NULL    /* config options */
139
148
}
140
149
DRIZZLE_DECLARE_PLUGIN_END;