56 char *buffer_p =
NULL;
97 if (class_stats_p ==
NULL)
129 if (class_stats_p->
n_attrs == 0)
142 for (i = 0, attr_stats_p = class_stats_p->
attr_stats; i < class_stats_p->n_attrs; i++, attr_stats_p++)
167 for (j = 0, btree_stats_p = attr_stats_p->
bt_stats; j < attr_stats_p->n_btstats; j++, btree_stats_p++)
212 for (k = 0; k < btree_stats_p->
pkeys_size; k++)
223 if (max_unique_keys > 0)
230 for (i = 0, attr_stats_p = class_stats_p->
attr_stats; i < class_stats_p->n_attrs; i++, attr_stats_p++)
232 for (j = 0, btree_stats_p = attr_stats_p->
bt_stats; j < attr_stats_p->n_btstats; j++, btree_stats_p++)
236 for (k = 0; k < btree_stats_p->
pkeys_size; k++)
239 btree_stats_p->
pkeys[k] = MIN (btree_stats_p->
pkeys[k], btree_stats_p->
keys);
244 return class_stats_p;
262 for (i = 0, attr_statsp = class_statsp->
attr_stats; i < class_statsp->n_attrs; i++, attr_statsp++)
266 for (j = 0; j < attr_statsp->
n_btstats; j++)
303 const char *prefix_p =
"";
307 if (class_mop ==
NULL)
313 if (smclass_p ==
NULL)
318 class_stats_p = smclass_p->
stats;
319 if (class_stats_p ==
NULL)
326 fprintf (file_p,
"\nCLASS STATISTICS\n");
327 fprintf (file_p,
"****************\n");
328 fprintf (file_p,
" Class name: %s Timestamp: %s", class_name_p, ctime (&tloc));
329 fprintf (file_p,
" Total pages in class heap: %d\n", class_stats_p->
heap_num_pages);
331 fprintf (file_p,
" Number of attributes: %d\n", class_stats_p->
n_attrs);
333 for (i = 0; i < class_stats_p->
n_attrs; i++)
338 fprintf (file_p,
" Attribute: %s\n", (name_p ? name_p :
"not found"));
339 fprintf (file_p,
" id: %d\n", attr_stats_p->
id);
340 fprintf (file_p,
" Type: ");
342 switch (attr_stats_p->
type)
345 fprintf (file_p,
"DB_TYPE_SHORT\n");
349 fprintf (file_p,
"DB_TYPE_INTEGER\n");
353 fprintf (file_p,
"DB_TYPE_BIGINT\n");
357 fprintf (file_p,
"DB_TYPE_FLOAT\n");
361 fprintf (file_p,
"DB_TYPE_DOUBLE\n");
365 fprintf (file_p,
"DB_TYPE_STRING\n");
369 fprintf (file_p,
"DB_TYPE_OBJECT\n");
373 fprintf (file_p,
"DB_TYPE_SET\n");
377 fprintf (file_p,
"DB_TYPE_MULTISET\n");
381 fprintf (file_p,
"DB_TYPE_SEQUENCE\n");
385 fprintf (file_p,
"DB_TYPE_TIME\n");
389 fprintf (file_p,
"DB_TYPE_TIMESTAMP\n");
393 fprintf (file_p,
"DB_TYPE_TIMESTAMPLTZ\n");
397 fprintf (file_p,
"DB_TYPE_TIMESTAMPTZ\n");
401 fprintf (file_p,
"DB_TYPE_DATETIME\n");
405 fprintf (file_p,
"DB_TYPE_DATETIMELTZ\n");
409 fprintf (file_p,
"DB_TYPE_DATETIMETZ\n");
413 fprintf (file_p,
"DB_TYPE_MONETARY\n");
417 fprintf (file_p,
"DB_TYPE_DATE\n");
421 fprintf (file_p,
"DB_TYPE_BLOB\n");
425 fprintf (file_p,
"DB_TYPE_CLOB\n");
429 fprintf (file_p,
"DB_TYPE_VARIABLE\n");
433 fprintf (file_p,
"DB_TYPE_SUB\n");
437 fprintf (file_p,
"DB_TYPE_POINTER\n");
441 fprintf (file_p,
"DB_TYPE_NULL\n");
445 fprintf (file_p,
"DB_TYPE_NUMERIC\n");
449 fprintf (file_p,
"DB_TYPE_BIT\n");
453 fprintf (file_p,
"DB_TYPE_VARBIT\n");
457 fprintf (file_p,
"DB_TYPE_CHAR\n");
461 fprintf (file_p,
"DB_TYPE_NCHAR\n");
465 fprintf (file_p,
"DB_TYPE_VARNCHAR\n");
469 fprintf (file_p,
"DB_TYPE_DB_VALUE\n");
473 fprintf (file_p,
"DB_TYPE_ENUMERATION\n");
478 fprintf (file_p,
"UNKNOWN_TYPE\n");
484 fprintf (file_p,
" B+tree statistics:\n");
486 for (j = 0; j < attr_stats_p->
n_btstats; j++)
488 bt_stats_p = &(attr_stats_p->
bt_stats[j]);
490 fprintf (file_p,
" BTID: { %d , %d }\n", bt_stats_p->
btid.
vfid.
volid,
492 fprintf (file_p,
" Cardinality: %d (", bt_stats_p->
keys);
498 fprintf (file_p,
"%s%d", prefix_p, bt_stats_p->
pkeys[k]);
501 fprintf (file_p,
") ,");
502 fprintf (file_p,
" Total pages: %d , Leaf pages: %d , Height: %d\n", bt_stats_p->
pages,
506 fprintf (file_p,
"\n");
509 fprintf (file_p,
"\n\n");
#define OR_BTID_ALIGNED_SIZE
struct tp_domain * setdomain
void stats_dump(const char *class_name_p, FILE *file_p)
int stats_get_statistics(OID *class_oid_p, unsigned int time_stamp, CLASS_STATS **stats_p)
const char * sm_get_att_name(MOP classop, int id)
void db_ws_free(void *ptr)
void stats_free_statistics(CLASS_STATS *class_statsp)
#define OR_GET_BTID(ptr, btid)
int tp_domain_size(const TP_DOMAIN *domain)
#define BTREE_STATS_PKEYS_NUM
#define TP_DOMAIN_TYPE(dom)
int stats_get_statistics_from_server(OID *classoid, unsigned int timestamp, int *length_ptr, char **stats_buffer)
static void error(const char *msg)
static CLASS_STATS * stats_client_unpack_statistics(char *buffer)
#define free_and_init(ptr)
void * db_ws_alloc(size_t size)
SM_CLASS * sm_get_class_with_statistics(MOP classop)
MOP sm_find_class(const char *name)
char * or_unpack_domain(char *ptr, struct tp_domain **domain_ptr, int *is_null)