Example #1
0
monitor_orc
monitor_orcNew (
                c_long extendCountLimit,
                const char*filterExpression,
                c_bool delta
                )
{
   monitor_orc o = malloc (C_SIZEOF(monitor_orc));

   if (o)
   {
      o->extendCountLimit = extendCountLimit;
      if (filterExpression)
      {
         o->filterExpression = os_strdup(filterExpression);
      }
      else
      {
	 o->filterExpression = NULL;
      }
      o->refTree = ut_tableNew (compareLeafs, NULL);
      o->totalSizeCount = 0;
      o->totalObjectCount = 0;
      o->delta = delta;
   }

   return o;
}
Example #2
0
monitor_orc
monitor_orcNew (
    c_long extendCountLimit,
    const char*filterExpression,
    c_bool delta
)
{
    char expressionError [1024];
    monitor_orc o = malloc (C_SIZEOF(monitor_orc));

    if (o) {
        o->extendCountLimit = extendCountLimit;
    }
    if (filterExpression) {
        o->filterExpression = os_strdup(filterExpression);
    } else {
        o->filterExpression = NULL;
    }
    if (o->filterExpression) {
        if (regcomp (&o->expression, o->filterExpression, REG_EXTENDED) != 0) {
            regerror (errno, &o->expression, expressionError, sizeof(expressionError));
            printf ("Filter expression error: %s\r\n", expressionError);
            regfree (&o->expression);
            free (o->filterExpression);
            o->filterExpression = NULL;
        }
    }
    o->refTree = ut_tableNew (compareLeafs, NULL);
    o->totalSizeCount = 0;
    o->totalObjectCount = 0;
    o->delta = delta;

    return o;
}
Example #3
0
monitor_trc
monitor_trcNew (
    c_long objectCountLimit,
    const char*filterExpression,
    orderKind oKind,
    int orderCount,
    c_bool delta
    )
{
    monitor_trc o = malloc (C_SIZEOF(monitor_trc));

    if (o)
    {
       o->objectCountLimit = objectCountLimit;
       if (filterExpression)
       {
          o->filterExpression = os_strdup(filterExpression);
       }
       else
       {
          o->filterExpression = NULL;
       }
       o->extTree = ut_tableNew (compareLeafs, NULL);
       o->delta = delta;
       o->oKind = oKind;
       o->orderCount = orderCount;
       o->index = 0;
       o->orderedList = NULL;
       o->cycleNr = 0;
    }
    return o;
}
Example #4
0
DDS::ReturnCode_t
DDS::OpenSplice::StrObjMap::init()
{
    DDS::ReturnCode_t result = DDS::RETCODE_OK;

    myStrMap = ut_tableNew(
            (ut_compareElementsFunc) DDS::OpenSplice::StrObjMap::fnCompareElements,
            NULL,
            (ut_freeElementFunc) DDS::OpenSplice::StrObjMap::fnFreeKey,
            NULL,
            (ut_freeElementFunc) DDS::OpenSplice::StrObjMap::fnFreeValue,
            &keepRef);
    if (myStrMap == NULL) {
        result = DDS::RETCODE_OUT_OF_RESOURCES;
        // TODO: OS_REPORT.
    }
    return result;
}
Example #5
0
/** \brief Initialize cond module
 */
void os_condModuleInit (void)
{
    os_mutexInit(&semCacheMutex, NULL);

    semCache = ut_tableNew (address_cmp, NULL, NULL, NULL, close_cached_item, NULL);
}
Example #6
0
/** \brief Initialize mutex module
 */
void os_mutexModuleInit (void)
{
    cache = (ut_collection) ut_tableNew (address_cmp, NULL, NULL, NULL, free_sem, NULL);
    cache_lock = semMCreate (SEM_Q_PRIORITY | SEM_DELETE_SAFE);
}
Example #7
0
void
monitor_trcAction (
    v_entity entity,
    c_voidp args
    )
{
    c_base base;
    monitor_trc trace = monitor_trc(args);
    time_t t;
    os_address totalSize;

    time (&t);
    base = c_getBase(entity);
    printf ("\r\n################# Start tracing ################## %s\r\n", ctime(&t));
    printf ("Limit             : %d\r\n", trace->objectCountLimit);
    if (trace->filterExpression) {
        printf ("Filter expression : %s\r\n", trace->filterExpression);
    }
    printf ("\r\n");
    if (trace->delta)
    {
        printf ("%6s (%8s) %8s %12s %-15s %-15s %s\r\n",
                "Delta",
                "ObjCount",
                "ObjSize",
                "TotalSize",
                "ObjectKind",
                "CollectionKind",
                "TypeName");
    }
    else
    {
        printf ("%8s %8s %12s %-15s %-15s %s\r\n",
                "ObjCount",
                "ObjSize",
                "TotalSize",
                "ObjectKind",
                "CollectionKind",
                "TypeName");
    }
    printf ("----------------------------------------------------------------------------------------------------------\r\n");
    trace->totalCount = 0;
    trace->totalExtentCount = 0;
    trace->index = 0;
    if (trace->oKind == NO_ORDERING)
    {
        c_metaWalk (c_metaObject (base), metaobject, trace);
    }
    else
    {
        trace->orderedList = ut_tableNew (orderLeafs, trace);
        c_metaWalk (c_metaObject (base), orderedWalk, trace);
        ut_walk(trace->orderedList, orderedAction, trace);
        ut_tableFree(trace->orderedList, NULL, NULL, NULL, NULL);
        trace->orderedList = NULL;
    }
    printf ("\r\n");
    printf ("        %ld  for %ld object headers (%d) and MM headers (%d)\r\n",
        trace->totalExtentCount * (C_SIZEOF(c_header)  + MM_HEADER_SIZE),
        trace->totalExtentCount,
        C_SIZEOF(c_header), MM_HEADER_SIZE);
    totalSize = trace->totalCount + trace->totalExtentCount * (C_SIZEOF(c_header)  + MM_HEADER_SIZE);
    printf ("Total : %d  (%.2f KB)\r\n", totalSize, (double)totalSize/1024.0);
    trace->cycleNr++;
}