IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32339


Ignore:
Timestamp:
Sep 6, 2011, 11:02:30 AM (15 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20110710/psLib/src
Files:
6 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110710/psLib/src/fits/Makefile.am

    r16185 r32339  
    99        psFitsImage.c \
    1010        psFitsTable.c \
     11        psFitsTableNew.c \
    1112        psFitsFloat.c \
    1213        psFitsFloatFile.c \
     
    2021        psFitsImage.h \
    2122        psFitsTable.h \
     23        psFitsTableNew.h \
    2224        psFitsFloat.h \
    2325        psFitsFloatFile.h \
  • branches/eam_branches/ipp-20110710/psLib/src/pslib_strict.h

    r27303 r32339  
    4141#include "psFitsImage.h"
    4242#include "psFitsTable.h"
     43#include "psFitsTableNew.h"
    4344#include "psFitsFloat.h"
    4445#include "psFitsFloatFile.h"
  • branches/eam_branches/ipp-20110710/psLib/src/sys/psMemory.c

    r31660 r32339  
    515515            continue;
    516516        }
    517         if (memBlock->nextBlock && memBlock->nextBlock->inFlight) {
    518             // nope, we need to try again
    519             MUTEX_UNLOCK(&memBlockListMutex);
    520             usleep (BLOCK_SLEEP);
    521             retryLock ++;
    522             continue;
    523         }
    524         if (memBlock->previousBlock && memBlock->previousBlock->inFlight) {
    525             // nope, we need to try again
    526             MUTEX_UNLOCK(&memBlockListMutex);
    527             usleep (BLOCK_SLEEP);
    528             retryLock ++;
    529             continue;
    530         }
     517        if (memBlock->nextBlock && memBlock->nextBlock->inFlight) {
     518            // we reply on the value of 'inFlight'.  we should crash if this block is corrupted
     519            if (memBlock->nextBlock->startblock != P_PS_MEMMAGIC) {
     520                PS_MEM_ABORT(__func__, "Unsafe to Continue\n");
     521            }
     522            if (memBlock->nextBlock->endblock != P_PS_MEMMAGIC) {
     523                PS_MEM_ABORT(__func__, "Unsafe to Continue\n");
     524            }
     525            // nope, we need to try again
     526            MUTEX_UNLOCK(&memBlockListMutex);
     527            usleep (BLOCK_SLEEP);
     528            retryLock ++;
     529            continue;
     530        }
     531        if (memBlock->previousBlock && memBlock->previousBlock->inFlight) {
     532            // we reply on the value of 'inFlight'.  we should crash if this block is corrupted
     533            if (memBlock->previousBlock->startblock != P_PS_MEMMAGIC) {
     534                PS_MEM_ABORT(__func__, "Unsafe to Continue\n");
     535            }
     536            if (memBlock->previousBlock->endblock != P_PS_MEMMAGIC) {
     537                PS_MEM_ABORT(__func__, "Unsafe to Continue\n");
     538            }
     539            // nope, we need to try again
     540            MUTEX_UNLOCK(&memBlockListMutex);
     541            usleep (BLOCK_SLEEP);
     542            retryLock ++;
     543            continue;
     544        }
    531545
    532546        // the markers are ours!
     
    889903                      psMemBlock ***array,
    890904                      FILE * fd,
    891                       bool persistence)
     905                      bool persistence,
     906                      int maxDisplayedLeaksCount          ///< List at most maxDisplayedLeaksCount (-1 for all)
     907                  )
    892908{
    893909    psS32 nleak = 0;
     
    896912
    897913    // XXX move this elsewhere?
    898     fprintf (stderr, "set %d locks, cleared %d locks, retry on %d locks (memID %ld)\n", setLock, clearLock, retryLock, memid);
     914    if (fd != NULL) {
     915      fprintf (fd, "set %d locks, cleared %d locks, retry on %d locks (memID %ld)\n", setLock, clearLock, retryLock, memid);
     916    }
    899917
    900918    // make sure that the memblock list is free of corruption before we crawl
     
    915933    for (memBlock = topBlock; memBlock->nextBlock != NULL; memBlock = memBlock->nextBlock) { }
    916934
     935    int maxToDisplay = maxDisplayedLeaksCount;
     936    psMemBlock *memBlockBackup = memBlock;
     937    if (maxToDisplay == -1 ) {
     938      for (; memBlock != NULL; memBlock = memBlock->previousBlock) {
     939        if ( (memBlock->refCounter > 0) &&
     940             ( (persistence) || (!persistence && !memBlock->persistent) ) &&
     941             (memBlock->id >= id0)) {
     942          nleak++;
     943        }
     944      }
     945      maxToDisplay=nleak;
     946    }
     947    if (fd != NULL) {
     948      fprintf(fd, "Number of leaks to display: %d\n", maxToDisplay);
     949    }
     950    memBlock = memBlockBackup;
     951
     952    nleak=0;
    917953    // iterate through the block list starting with the oldest block
    918954    for (; memBlock != NULL; memBlock = memBlock->previousBlock) {
     
    924960
    925961            // only print a max of 500 leaks (make this an argument)
    926             if ((nleak < 500) && (fd != NULL)) {
     962            if ( (nleak <= maxToDisplay) && (fd != NULL) ) {
    927963                if (nleak == 1) {
    928964                    fprintf(fd, "# func at (file:line)  ID: X  Ref: X\n");
  • branches/eam_branches/ipp-20110710/psLib/src/sys/psMemory.h

    r31660 r32339  
    367367    bool persistence                   ///< make check across all object even persistent ones
    368368);
     369int psMemCheckLeaks2(
     370    psMemId id0,                       ///< don't list blocks with id < id0
     371    psMemBlock ***array,               ///< pointer to array of pointers to leaked blocks, or NULL
     372    FILE * fd,                         ///< print list of leaks to fd (or NULL)
     373    bool persistence,                  ///< make check across all object even persistent ones
     374    int maxDisplayedLeaksCount         ///< List at most maxDisplayedLeaksCount (-1 for all)
     375);
    369376#else // ifdef DOXYGEN
    370377int p_psMemCheckLeaks(
     
    375382    psMemBlock ***array,                ///< pointer to array of pointers to leaked blocks, or NULL
    376383    FILE * fd,                          ///< print list of leaks to fd (or NULL)
    377     bool persistence                    ///< make check across all object even persistent ones
    378 );
    379 #ifndef SWIG
     384    bool persistence,                   ///< make check across all object even persistent ones
     385    int maxDisplayedLeaksCount          ///< List at most maxDisplayedLeaksCount (-1 for all)
     386);
     387#ifndef SWIG
     388#define psMemCheckLeaks2(id0, array, fd, persistence, maxDisplayedLeaksCount) \
     389      p_psMemCheckLeaks(__FILE__, __LINE__, __func__, id0, array, fd, persistence, maxDisplayedLeaksCount)
    380390#define psMemCheckLeaks(id0, array, fd, persistence) \
    381       p_psMemCheckLeaks(__FILE__, __LINE__, __func__, id0, array, fd, persistence)
     391      p_psMemCheckLeaks(__FILE__, __LINE__, __func__, id0, array, fd, persistence, 500)
    382392#endif // ifndef SWIG
    383393#endif // ifdef DOXYGEN
  • branches/eam_branches/ipp-20110710/psLib/src/types/psMetadataConfig.c

    r29934 r32339  
    7272static bool parseMetadataItem(char *keyName, psArray *levelArray,
    7373                              char *linePtr, psMetadataFlags flags);
    74 static psString formatMetadataItem(psMetadataItem *item);
    7574static psArray *p_psMetadataKeyArray(psMetadata *md);
    7675static bool parseGeneric(char *keyName,
     
    13371336            return NULL;
    13381337        }
    1339         psString str = formatMetadataItem(item);
     1338        psString str = psMetadataItemFormat(item);
    13401339        if (!str) {
    13411340            psError(PS_ERR_UNKNOWN, false, "failed to format psMetadataItem");
     
    13551354}
    13561355
    1357 
    1358 static psString formatMetadataItem(psMetadataItem *item)
     1356// format a single metadata item for output (consistent with config dump I/O, includes return char)
     1357psString psMetadataItemFormat(psMetadataItem *item)
    13591358{
    13601359    PS_ASSERT_METADATA_ITEM_NON_NULL(item, NULL);
     
    13801379            psMetadataItem *multiItem = NULL;
    13811380            while ((multiItem = psListGetAndIncrement(iter))) {
    1382                 psString str = formatMetadataItem(multiItem);
     1381                psString str = psMetadataItemFormat(multiItem);
    13831382                psStringAppend(&content, "%s", str);
    13841383                psFree(str);
     
    15971596}
    15981597
    1599 
    16001598static psArray *p_psMetadataKeyArray(psMetadata *md)
    16011599{
  • branches/eam_branches/ipp-20110710/psLib/src/types/psMetadataConfig.h

    r29934 r32339  
    7979);
    8080
     81/** format metadata item.
     82 *
     83 *  Metadata Item is formatted to a string consistent with the MDC file formats
     84 *
     85 *  @return char:           allocated formatted string
     86*/
     87psString psMetadataItemFormat(psMetadataItem *item);
     88
    8189/** Converts a psMetadata structure (including any nested psMetadata) into a
    8290 *  configuration file formatted string that is written out to filename.
Note: See TracChangeset for help on using the changeset viewer.