lxt2_read.h File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <unistd.h>
#include <inttypes.h>

Go to the source code of this file.

Data Structures

struct  lxt2_rd_block
struct  lxt2_rd_geometry
struct  lxt2_rd_facname_cache
struct  lxt2_rd_trace

Defines

#define _LXT2_RD_INLINE
#define LXT2_RDLOAD   "LXTLOAD | "
#define LXT2_RD_HDRID   (0x1380)
#define LXT2_RD_VERSION   (0x0001)
#define LXT2_RD_GRANULE_SIZE   (64)
#define LXT2_RD_PARTIAL_SIZE   (2048)
#define LXT2_RD_GRAN_SECT_TIME   0
#define LXT2_RD_GRAN_SECT_DICT   1
#define LXT2_RD_GRAN_SECT_TIME_PARTIAL   2
#define LXT2_RD_MAX_BLOCK_MEM_USAGE   (64*1024*1024)
#define LXT2_RD_LLD   "%lld"
#define LXT2_RD_LLDESC(x)   x##LL
#define LXT2_RD_ULLDESC(x)   x##ULL
#define LXT2_RD_GRAN_0VAL   (0)
#define LXT2_RD_GRAN_1VAL   (1)
#define get_fac_msk   lxt2_rd_get_32
#define LXT2_RD_SYM_F_BITS   (0)
#define LXT2_RD_SYM_F_INTEGER   (1<<0)
#define LXT2_RD_SYM_F_DOUBLE   (1<<1)
#define LXT2_RD_SYM_F_STRING   (1<<2)
#define LXT2_RD_SYM_F_TIME   (LXT2_RD_SYM_F_STRING)
#define LXT2_RD_SYM_F_ALIAS   (1<<3)
#define LXT2_RD_SYM_F_SIGNED   (1<<4)
#define LXT2_RD_SYM_F_BOOLEAN   (1<<5)
#define LXT2_RD_SYM_F_NATURAL   ((1<<6)|(LXT2_RD_SYM_F_INTEGER))
#define LXT2_RD_SYM_F_POSITIVE   ((1<<7)|(LXT2_RD_SYM_F_INTEGER))
#define LXT2_RD_SYM_F_CHARACTER   (1<<8)
#define LXT2_RD_SYM_F_CONSTANT   (1<<9)
#define LXT2_RD_SYM_F_VARIABLE   (1<<10)
#define LXT2_RD_SYM_F_SIGNAL   (1<<11)
#define LXT2_RD_SYM_F_IN   (1<<12)
#define LXT2_RD_SYM_F_OUT   (1<<13)
#define LXT2_RD_SYM_F_INOUT   (1<<14)
#define LXT2_RD_SYM_F_WIRE   (1<<15)
#define LXT2_RD_SYM_F_REG   (1<<16)

Typedefs

typedef uint8_t lxtint8_t
typedef uint16_t lxtint16_t
typedef uint32_t lxtint32_t
typedef uint64_t lxtint64_t
typedef lxtint32_t granmsk_t

Enumerations

enum  LXT2_RD_Encodings {
  LXT2_RD_ENC_0, LXT2_RD_ENC_1, LXT2_RD_ENC_INV, LXT2_RD_ENC_LSH0,
  LXT2_RD_ENC_LSH1, LXT2_RD_ENC_RSH0, LXT2_RD_ENC_RSH1, LXT2_RD_ENC_ADD1,
  LXT2_RD_ENC_ADD2, LXT2_RD_ENC_ADD3, LXT2_RD_ENC_ADD4, LXT2_RD_ENC_SUB1,
  LXT2_RD_ENC_SUB2, LXT2_RD_ENC_SUB3, LXT2_RD_ENC_SUB4, LXT2_RD_ENC_X,
  LXT2_RD_ENC_Z, LXT2_RD_ENC_BLACKOUT, LXT2_RD_DICT_START
}

Functions

struct lxt2_rd_tracelxt2_rd_init (const char *name)
void lxt2_rd_close (struct lxt2_rd_trace *lt)
_LXT2_RD_INLINE lxtint64_t lxt2_rd_set_max_block_mem_usage (struct lxt2_rd_trace *lt, lxtint64_t block_mem_max)
_LXT2_RD_INLINE lxtint64_t lxt2_rd_get_block_mem_usage (struct lxt2_rd_trace *lt)
_LXT2_RD_INLINE unsigned int lxt2_rd_get_num_blocks (struct lxt2_rd_trace *lt)
unsigned int lxt2_rd_get_num_active_blocks (struct lxt2_rd_trace *lt)
_LXT2_RD_INLINE lxtint32_t lxt2_rd_get_num_facs (struct lxt2_rd_trace *lt)
char * lxt2_rd_get_facname (struct lxt2_rd_trace *lt, lxtint32_t facidx)
struct lxt2_rd_geometrylxt2_rd_get_fac_geometry (struct lxt2_rd_trace *lt, lxtint32_t facidx)
_LXT2_RD_INLINE lxtint32_t lxt2_rd_get_fac_rows (struct lxt2_rd_trace *lt, lxtint32_t facidx)
_LXT2_RD_INLINE lxtint32_t lxt2_rd_get_fac_msb (struct lxt2_rd_trace *lt, lxtint32_t facidx)
_LXT2_RD_INLINE lxtint32_t lxt2_rd_get_fac_lsb (struct lxt2_rd_trace *lt, lxtint32_t facidx)
_LXT2_RD_INLINE lxtint32_t lxt2_rd_get_fac_flags (struct lxt2_rd_trace *lt, lxtint32_t facidx)
_LXT2_RD_INLINE lxtint32_t lxt2_rd_get_fac_len (struct lxt2_rd_trace *lt, lxtint32_t facidx)
_LXT2_RD_INLINE lxtint32_t lxt2_rd_get_alias_root (struct lxt2_rd_trace *lt, lxtint32_t facidx)
_LXT2_RD_INLINE char lxt2_rd_get_timescale (struct lxt2_rd_trace *lt)
_LXT2_RD_INLINE lxtint64_t lxt2_rd_get_start_time (struct lxt2_rd_trace *lt)
_LXT2_RD_INLINE lxtint64_t lxt2_rd_get_end_time (struct lxt2_rd_trace *lt)
_LXT2_RD_INLINE int lxt2_rd_get_fac_process_mask (struct lxt2_rd_trace *lt, lxtint32_t facidx)
_LXT2_RD_INLINE int lxt2_rd_set_fac_process_mask (struct lxt2_rd_trace *lt, lxtint32_t facidx)
_LXT2_RD_INLINE int lxt2_rd_clr_fac_process_mask (struct lxt2_rd_trace *lt, lxtint32_t facidx)
_LXT2_RD_INLINE int lxt2_rd_set_fac_process_mask_all (struct lxt2_rd_trace *lt)
_LXT2_RD_INLINE int lxt2_rd_clr_fac_process_mask_all (struct lxt2_rd_trace *lt)
int lxt2_rd_iter_blocks (struct lxt2_rd_trace *lt, void(*value_change_callback)(struct lxt2_rd_trace **lt, lxtint64_t *time, lxtint32_t *facidx, char **value), void *user_callback_data_pointer)
_LXT2_RD_INLINE void * lxt2_rd_get_user_callback_data_pointer (struct lxt2_rd_trace *lt)
unsigned int lxt2_rd_limit_time_range (struct lxt2_rd_trace *lt, lxtint64_t strt_time, lxtint64_t end_time)
unsigned int lxt2_rd_unlimit_time_range (struct lxt2_rd_trace *lt)

Define Documentation

#define _LXT2_RD_INLINE
#define get_fac_msk   lxt2_rd_get_32

Referenced by lxt2_rd_process_block().

#define LXT2_RD_GRAN_0VAL   (0)
#define LXT2_RD_GRAN_1VAL   (1)
#define LXT2_RD_GRAN_SECT_DICT   1

Referenced by lxt2_rd_process_block().

#define LXT2_RD_GRAN_SECT_TIME   0

Referenced by lxt2_rd_process_block().

#define LXT2_RD_GRAN_SECT_TIME_PARTIAL   2

Referenced by lxt2_rd_process_block().

#define LXT2_RD_GRANULE_SIZE   (64)
#define LXT2_RD_HDRID   (0x1380)
#define LXT2_RD_LLD   "%lld"
#define LXT2_RD_LLDESC (  )     x##LL
#define LXT2_RD_MAX_BLOCK_MEM_USAGE   (64*1024*1024)
#define LXT2_RD_PARTIAL_SIZE   (2048)
#define LXT2_RD_SYM_F_ALIAS   (1<<3)

Referenced by lxt2_rd_get_alias_root().

#define LXT2_RD_SYM_F_BITS   (0)
#define LXT2_RD_SYM_F_BOOLEAN   (1<<5)
#define LXT2_RD_SYM_F_CHARACTER   (1<<8)
#define LXT2_RD_SYM_F_CONSTANT   (1<<9)
#define LXT2_RD_SYM_F_DOUBLE   (1<<1)
#define LXT2_RD_SYM_F_IN   (1<<12)
#define LXT2_RD_SYM_F_INOUT   (1<<14)
#define LXT2_RD_SYM_F_INTEGER   (1<<0)
#define LXT2_RD_SYM_F_NATURAL   ((1<<6)|(LXT2_RD_SYM_F_INTEGER))
#define LXT2_RD_SYM_F_OUT   (1<<13)
#define LXT2_RD_SYM_F_POSITIVE   ((1<<7)|(LXT2_RD_SYM_F_INTEGER))
#define LXT2_RD_SYM_F_REG   (1<<16)
#define LXT2_RD_SYM_F_SIGNAL   (1<<11)
#define LXT2_RD_SYM_F_SIGNED   (1<<4)
#define LXT2_RD_SYM_F_STRING   (1<<2)
#define LXT2_RD_SYM_F_TIME   (LXT2_RD_SYM_F_STRING)
#define LXT2_RD_SYM_F_VARIABLE   (1<<10)
#define LXT2_RD_SYM_F_WIRE   (1<<15)
#define LXT2_RD_ULLDESC (  )     x##ULL
#define LXT2_RD_VERSION   (0x0001)
#define LXT2_RDLOAD   "LXTLOAD | "

Typedef Documentation

typedef uint16_t lxtint16_t
typedef uint32_t lxtint32_t
typedef uint64_t lxtint64_t
typedef uint8_t lxtint8_t

Enumeration Type Documentation

Enumerator:
LXT2_RD_ENC_0 
LXT2_RD_ENC_1 
LXT2_RD_ENC_INV 
LXT2_RD_ENC_LSH0 
LXT2_RD_ENC_LSH1 
LXT2_RD_ENC_RSH0 
LXT2_RD_ENC_RSH1 
LXT2_RD_ENC_ADD1 
LXT2_RD_ENC_ADD2 
LXT2_RD_ENC_ADD3 
LXT2_RD_ENC_ADD4 
LXT2_RD_ENC_SUB1 
LXT2_RD_ENC_SUB2 
LXT2_RD_ENC_SUB3 
LXT2_RD_ENC_SUB4 
LXT2_RD_ENC_X 
LXT2_RD_ENC_Z 
LXT2_RD_ENC_BLACKOUT 
LXT2_RD_DICT_START 

00131                        {
00132         LXT2_RD_ENC_0,
00133         LXT2_RD_ENC_1,
00134         LXT2_RD_ENC_INV,
00135         LXT2_RD_ENC_LSH0,
00136         LXT2_RD_ENC_LSH1,
00137         LXT2_RD_ENC_RSH0,
00138         LXT2_RD_ENC_RSH1,
00139 
00140         LXT2_RD_ENC_ADD1,
00141         LXT2_RD_ENC_ADD2,
00142         LXT2_RD_ENC_ADD3,
00143         LXT2_RD_ENC_ADD4,
00144 
00145         LXT2_RD_ENC_SUB1,
00146         LXT2_RD_ENC_SUB2,
00147         LXT2_RD_ENC_SUB3,
00148         LXT2_RD_ENC_SUB4,
00149 
00150         LXT2_RD_ENC_X,
00151         LXT2_RD_ENC_Z, 
00152 
00153         LXT2_RD_ENC_BLACKOUT,
00154 
00155         LXT2_RD_DICT_START
00156         };


Function Documentation

void lxt2_rd_close ( struct lxt2_rd_trace lt  ) 

References lxt2_rd_trace::block_curr, lxt2_rd_trace::block_head, lxt2_rd_facname_cache::bufcurr, lxt2_rd_facname_cache::bufprev, lxt2_rd_trace::fac_curpos, lxt2_rd_trace::fac_map, lxt2_rd_trace::faccache, lxt2_rd_trace::flags, free_safe, lxt2_rd_trace::handle, lxt2_rd_trace::len, lxt2_rd_trace::longestname, lxt2_rd_trace::lsb, LXT2_RD_PARTIAL_SIZE, lxt2_rd_block::mem, lxt2_rd_trace::msb, lxt2_rd_block::next, lxt2_rd_trace::next_radix, lxt2_rd_block::num_dict_entries, lxt2_rd_trace::numfacs, lxt2_rd_trace::process_mask, lxt2_rd_trace::process_mask_compressed, PROFILE, PROFILE_END, lxt2_rd_trace::rows, lxt2_rd_block::string_lens, lxt2_rd_block::string_pointers, lxt2_rd_block::uncompressed_siz, lxt2_rd_trace::value, lxt2_rd_trace::zfacname_predec_size, and lxt2_rd_trace::zfacnames.

Referenced by lxt_parse().

01124   { PROFILE(LXT2_RD_CLOSE);
01125 
01126   if( lt ) {
01127 
01128     struct lxt2_rd_block* b;
01129     struct lxt2_rd_block* bt;
01130     unsigned int          i;
01131 
01132     if( lt->value != NULL ) {
01133       for( i=0; i<lt->numfacs; i++ ) {
01134         free_safe( lt->value[i], (strlen( lt->value[i] ) + 1) );
01135         lt->value[i] = NULL; 
01136       }
01137       free_safe( lt->value, (lt->numfacs * sizeof( char* )) );
01138       lt->value = NULL;
01139     }
01140 
01141     free_safe( lt->process_mask, ((lt->numfacs / 8) + 1) );
01142     free_safe( lt->process_mask_compressed, ((lt->numfacs / LXT2_RD_PARTIAL_SIZE) + 1) );
01143     free_safe( lt->rows,  (lt->numfacs * sizeof( lxtint32_t )) );
01144     free_safe( lt->msb,   (lt->numfacs * sizeof( lxtint32_t )) );
01145     free_safe( lt->lsb,   (lt->numfacs * sizeof( lxtint32_t )) );
01146     free_safe( lt->flags, (lt->numfacs * sizeof( lxtint32_t )) );
01147     free_safe( lt->len,   (lt->numfacs * sizeof( lxtint32_t )) );
01148     free_safe( lt->next_radix, (lt->numfacs * sizeof( void* )) );
01149 
01150     lt->process_mask            = NULL;
01151     lt->process_mask_compressed = NULL;
01152     lt->rows                    = NULL;
01153     lt->msb                     = NULL;
01154     lt->lsb                     = NULL;
01155     lt->flags                   = NULL;
01156     lt->len                     = NULL;
01157     lt->next_radix              = NULL;
01158 
01159     free_safe( lt->zfacnames, lt->zfacname_predec_size );
01160     lt->zfacnames = NULL;
01161 
01162     if( lt->faccache ) {
01163 
01164       free_safe( lt->faccache->bufprev, (lt->longestname + 1) );
01165       free_safe( lt->faccache->bufcurr, (lt->longestname + 1) );
01166 
01167       lt->faccache->bufprev = NULL;
01168       lt->faccache->bufcurr = NULL;
01169 
01170       free_safe( lt->faccache, sizeof( struct lxt2_rd_facname_cache ) );
01171       lt->faccache = NULL;
01172 
01173     }
01174 
01175     free_safe( lt->fac_map, lt->numfacs * sizeof( granmsk_t ) );
01176     lt->fac_map = NULL;
01177     free_safe( lt->fac_curpos, lt->numfacs * sizeof( char* ) );
01178     lt->fac_curpos = NULL;
01179 
01180     b = lt->block_head;
01181     while( b ) {
01182 
01183       bt = b->next;
01184 
01185       free_safe( b->mem, b->uncompressed_siz );
01186       free_safe( b->string_pointers, (b->num_dict_entries * sizeof( char* )) );
01187       free_safe( b->string_lens, (b->num_dict_entries * sizeof( unsigned int)) );
01188 
01189       b->mem             = NULL;
01190       b->string_pointers = NULL;
01191       b->string_lens     = NULL;
01192 
01193       free_safe( b, sizeof( struct lxt2_rd_block ) );
01194 
01195       b = bt;
01196 
01197     }
01198 
01199     lt->block_head = lt->block_curr = NULL;
01200 
01201 #ifdef HAVE_LIBZ
01202     if( lt->zhandle ) {
01203       unsigned int rv = gzclose( lt->zhandle );
01204       assert( rv == Z_OK );
01205       lt->zhandle = NULL;
01206     }
01207 #endif
01208 
01209     if( lt->handle ) {
01210       unsigned int rv = fclose( lt->handle );
01211       assert( rv == 0 );
01212       lt->handle = NULL;
01213     }
01214 
01215     free_safe( lt, sizeof( struct lxt2_rd_trace ) );
01216 
01217   }
01218 
01219   PROFILE_END;
01220 
01221 }

_LXT2_RD_INLINE int lxt2_rd_clr_fac_process_mask ( struct lxt2_rd_trace lt,
lxtint32_t  facidx 
)

References lxt2_rd_trace::process_mask, and lxt2_rd_trace::process_mask_dirty.

01481                                                                                                 {
01482 
01483   int rc = 0;
01484 
01485   if( lt ) {
01486 
01487     lt->process_mask_dirty = 1;
01488 
01489     if( facidx < lt->numfacs) {
01490       int idx    = facidx / 8;
01491       int bitpos = facidx & 7;
01492       /*@-shiftnegative@*/
01493       lt->process_mask[idx] &= ~(1 << bitpos);
01494       /*@=shiftnegative@*/
01495     }
01496 
01497     rc = 1;
01498 
01499   }
01500 
01501   return( rc );
01502 
01503 }

_LXT2_RD_INLINE int lxt2_rd_clr_fac_process_mask_all ( struct lxt2_rd_trace lt  ) 

References lxt2_rd_trace::numfacs, lxt2_rd_trace::process_mask, and lxt2_rd_trace::process_mask_dirty.

01519                                                                                  {
01520 
01521   int rc = 0;
01522 
01523   if( lt ) {
01524     lt->process_mask_dirty = 1;
01525     memset( lt->process_mask, 0x00, ((lt->numfacs + 7) / 8) );
01526     rc = 1;
01527   }
01528 
01529   return( rc );
01530 
01531 }

_LXT2_RD_INLINE lxtint32_t lxt2_rd_get_alias_root ( struct lxt2_rd_trace lt,
lxtint32_t  facidx 
)

References lxt2_rd_trace::flags, LXT2_RD_SYM_F_ALIAS, and lxt2_rd_trace::rows.

Referenced by lxt_parse().

01313                                                                                                {
01314 
01315   if( lt && (facidx < lt->numfacs) ) {
01316 
01317     while( lt->flags[facidx] & LXT2_RD_SYM_F_ALIAS ) {
01318       facidx = lt->rows[facidx];        /* iterate to next alias */
01319     }
01320 
01321     return( facidx );
01322 
01323   } else {
01324 
01325     return( ~((lxtint32_t)0) );
01326 
01327   }
01328 
01329 }

_LXT2_RD_INLINE lxtint64_t lxt2_rd_get_block_mem_usage ( struct lxt2_rd_trace lt  ) 

References lxt2_rd_trace::block_mem_consumed.

01546                                                                                    {
01547 
01548   return( lt->block_mem_consumed );
01549 
01550 }

_LXT2_RD_INLINE lxtint64_t lxt2_rd_get_end_time ( struct lxt2_rd_trace lt  ) 

References lxt2_rd_trace::end, and LXT2_RD_GRAN_0VAL.

01340                                                                             {
01341 
01342   return( lt ? lt->end : LXT2_RD_GRAN_0VAL );
01343 
01344 }

_LXT2_RD_INLINE lxtint32_t lxt2_rd_get_fac_flags ( struct lxt2_rd_trace lt,
lxtint32_t  facidx 
)

References lxt2_rd_trace::flags.

01293                                                                                                 {
01294 
01295   if( lt && (facidx < lt->numfacs) ) {
01296     return( lt->flags[facidx] );
01297   } else {
01298     return( 0 );
01299   }
01300 
01301 }

struct lxt2_rd_geometry* lxt2_rd_get_fac_geometry ( struct lxt2_rd_trace lt,
lxtint32_t  facidx 
) [read]

References lxt2_rd_trace::flags, lxt2_rd_geometry::flags, lxt2_rd_trace::geometry, lxt2_rd_trace::len, lxt2_rd_geometry::len, lxt2_rd_trace::lsb, lxt2_rd_geometry::lsb, lxt2_rd_trace::msb, lxt2_rd_geometry::msb, lxt2_rd_trace::rows, and lxt2_rd_geometry::rows.

Referenced by lxt_parse(), and vcd_callback().

01241   {
01242 
01243   if( lt && (facidx < lt->numfacs) ) {
01244     lt->geometry.rows  = lt->rows[facidx];      
01245     lt->geometry.msb   = lt->msb[facidx];       
01246     lt->geometry.lsb   = lt->lsb[facidx];       
01247     lt->geometry.flags = lt->flags[facidx];     
01248     lt->geometry.len   = lt->len[facidx];       
01249     return( &lt->geometry );
01250   } else {
01251     return( NULL );
01252   }
01253 
01254 }

_LXT2_RD_INLINE lxtint32_t lxt2_rd_get_fac_len ( struct lxt2_rd_trace lt,
lxtint32_t  facidx 
)

References lxt2_rd_trace::len.

01303                                                                                               {
01304 
01305   if( lt && (facidx < lt->numfacs) ) {
01306     return( lt->len[facidx] );
01307   } else {
01308     return( 0 );
01309   }
01310 
01311 }

_LXT2_RD_INLINE lxtint32_t lxt2_rd_get_fac_lsb ( struct lxt2_rd_trace lt,
lxtint32_t  facidx 
)

References lxt2_rd_trace::lsb.

01282                                                                                               {
01283 
01284   if( lt && (facidx < lt->numfacs) ) {
01285     return( lt->lsb[facidx] );
01286   } else {
01287     return( 0 );
01288   }
01289 
01290 }

_LXT2_RD_INLINE lxtint32_t lxt2_rd_get_fac_msb ( struct lxt2_rd_trace lt,
lxtint32_t  facidx 
)

References lxt2_rd_trace::msb.

01271                                                                                              {
01272 
01273   if( lt && (facidx < lt->numfacs) ) {
01274     return( lt->msb[facidx] );
01275   } else {
01276     return( 0 );
01277   }
01278 
01279 }

_LXT2_RD_INLINE int lxt2_rd_get_fac_process_mask ( struct lxt2_rd_trace lt,
lxtint32_t  facidx 
)

References lxt2_rd_trace::process_mask.

01438                                                                                                 {
01439 
01440   if( lt ) {
01441 
01442     if( facidx < lt->numfacs ) {
01443       int process_idx = facidx / 8;
01444       int process_bit = facidx & 7;
01445       /*@-shiftnegative@*/
01446       return( (lt->process_mask[process_idx] & (1 << process_bit)) != 0 );
01447       /*@=shiftnegative@*/
01448     }
01449 
01450   }
01451 
01452   return( 0 );
01453 
01454 }

_LXT2_RD_INLINE lxtint32_t lxt2_rd_get_fac_rows ( struct lxt2_rd_trace lt,
lxtint32_t  facidx 
)

References lxt2_rd_trace::rows.

01260                                                                                                {
01261 
01262   if( lt && (facidx < lt->numfacs) ) {
01263     return( lt->rows[facidx] );
01264   } else {
01265     return( 0 );
01266   }
01267 
01268 }

char* lxt2_rd_get_facname ( struct lxt2_rd_trace lt,
lxtint32_t  facidx 
)

References lxt2_rd_facname_cache::bufcurr, lxt2_rd_facname_cache::bufprev, lxt2_rd_trace::faccache, lxt2_rd_get_16(), lxt2_rd_get_byte, lxt2_rd_get_facname(), lxt2_rd_facname_cache::n, lxt2_rd_trace::numfacs, lxt2_rd_facname_cache::old_facidx, PROFILE, PROFILE_END, and lxt2_rd_trace::zfacnames.

Referenced by lxt2_rd_get_facname(), and lxt_parse().

01360   { PROFILE(LXT2_RD_GET_FACNAME);
01361 
01362   char* pnt;
01363   unsigned int clone, j;
01364 
01365   if( lt ) {
01366 
01367     if( (facidx == (lt->faccache->old_facidx + 1)) || !facidx ) {
01368 
01369       if( !facidx ) {
01370         lt->faccache->n          = lt->zfacnames;
01371         lt->faccache->bufcurr[0] = 0;                   
01372         lt->faccache->bufprev[0] = 0;                   
01373       }
01374 
01375       if( facidx != lt->numfacs ) {
01376 
01377         pnt = lt->faccache->bufcurr;
01378         lt->faccache->bufcurr = lt->faccache->bufprev;
01379         lt->faccache->bufprev = pnt;
01380 
01381         clone = lxt2_rd_get_16( lt->faccache->n, 0 );
01382         lt->faccache->n += 2;
01383         pnt = lt->faccache->bufcurr;
01384 
01385         for( j=0; j<clone; j++ ) {
01386           *(pnt++) = lt->faccache->bufprev[j];
01387         }
01388 
01389         while( (*(pnt++) = lxt2_rd_get_byte( lt->faccache->n++, 0 )) );
01390 
01391         lt->faccache->old_facidx = facidx;
01392 
01393         return( lt->faccache->bufcurr );
01394 
01395       } else {
01396 
01397         return( NULL ); /* no more left */
01398 
01399       }
01400 
01401     } else {
01402 
01403       if( facidx < lt->numfacs ) {              
01404 
01405         int strt;
01406 
01407         if( facidx == lt->faccache->old_facidx ) {
01408           return( lt->faccache->bufcurr );
01409         }
01410 
01411         if( facidx > (lt->faccache->old_facidx + 1) ) {
01412           strt = lt->faccache->old_facidx + 1;
01413         } else {
01414           strt = 0;
01415         }
01416 
01417         for( j=strt; j<facidx; j++ ) {
01418           (void)lxt2_rd_get_facname( lt, j );
01419         }
01420         
01421         return( lxt2_rd_get_facname( lt, j ) );
01422 
01423       }
01424 
01425     }
01426 
01427   }
01428 
01429   PROFILE_END;
01430 
01431   return( NULL );
01432 
01433 }

unsigned int lxt2_rd_get_num_active_blocks ( struct lxt2_rd_trace lt  ) 

References lxt2_rd_trace::block_head, lxt2_rd_block::exclude_block, lxt2_rd_block::next, and lxt2_rd_block::short_read_ignore.

01564                                                                        {
01565 
01566   int blk = 0;
01567 
01568   if( lt ) {
01569 
01570     struct lxt2_rd_block* b = lt->block_head;
01571 
01572     while( b ) {
01573       if( !b->short_read_ignore && !b->exclude_block ) {
01574         blk++;
01575       }
01576       b = b->next;
01577     }
01578 
01579   }
01580 
01581   return( blk );
01582 
01583 }

_LXT2_RD_INLINE unsigned int lxt2_rd_get_num_blocks ( struct lxt2_rd_trace lt  ) 

References lxt2_rd_trace::numblocks.

01555                                                                                 {
01556 
01557   return( lt->numblocks );
01558 
01559 }

_LXT2_RD_INLINE lxtint32_t lxt2_rd_get_num_facs ( struct lxt2_rd_trace lt  ) 

References lxt2_rd_trace::numfacs.

Referenced by lxt_parse().

01228                                                                             {
01229 
01230   return( lt ? lt->numfacs : 0 );
01231 
01232 }

_LXT2_RD_INLINE lxtint64_t lxt2_rd_get_start_time ( struct lxt2_rd_trace lt  ) 

References LXT2_RD_GRAN_0VAL, and lxt2_rd_trace::start.

01334                                                                               {
01335 
01336   return( lt ? lt->start : LXT2_RD_GRAN_0VAL );
01337 
01338 }

_LXT2_RD_INLINE char lxt2_rd_get_timescale ( struct lxt2_rd_trace lt  ) 

References lxt2_rd_trace::timescale.

01346                                                                        {
01347 
01348   return( lt ? lt->timescale : 0 );
01349 
01350 }

_LXT2_RD_INLINE void* lxt2_rd_get_user_callback_data_pointer ( struct lxt2_rd_trace lt  ) 

References lxt2_rd_trace::user_callback_data_pointer.

01813                                                                                          {
01814 
01815   if( lt ) {
01816     return( lt->user_callback_data_pointer );
01817   } else {
01818     return( NULL );
01819   }
01820 
01821 }

struct lxt2_rd_trace* lxt2_rd_init ( const char *  name  )  [read]

References FATAL, and print_output().

Referenced by lxt_parse().

00822                                                        {
00823 
00824   print_output( "Unable to parse LXT dumpfile due to missing zlib library in the build of Covered", FATAL, __FILE__, __LINE__ );
00825   return( NULL );
00826 
00827 }

int lxt2_rd_iter_blocks ( struct lxt2_rd_trace lt,
void(*)(struct lxt2_rd_trace **lt, lxtint64_t *time, lxtint32_t *facidx, char **value)  value_change_callback,
void *  user_callback_data_pointer 
)

Referenced by lxt_parse().

01590                                                             {
01591   return( 0 );
01592 }

unsigned int lxt2_rd_limit_time_range ( struct lxt2_rd_trace lt,
lxtint64_t  strt_time,
lxtint64_t  end_time 
)
Returns:
Returns the number of active blocks within the time range

Limits access to a given timerange in the LXT file

Parameters:
lt Pointer to LXT read tracer
strt_time Starting time to limit access to
end_time Ending time to limit access to

References lxt2_rd_trace::block_head, lxt2_rd_block::end, lxt2_rd_block::exclude_block, lxt2_rd_block::next, PROFILE, PROFILE_END, lxt2_rd_block::short_read_ignore, and lxt2_rd_block::start.

01832   { PROFILE(LXT2_RD_LIMIT_TIME_RANGE);
01833 
01834   lxtint64_t tmp_time;
01835   int        blk = 0;
01836 
01837   if( lt ) {
01838 
01839     struct lxt2_rd_block* b     = lt->block_head;
01840     struct lxt2_rd_block* bprev = NULL;
01841     int                   state = 0;
01842 
01843     if( strt_time > end_time ) {
01844       tmp_time  = strt_time;
01845       strt_time = end_time;
01846       end_time  = tmp_time;
01847     }
01848 
01849     while( b ) {
01850 
01851       switch( state ) {
01852         case 0 :
01853           if( b->end >= strt_time ) {
01854             state = 1;
01855             if( (b->start > strt_time) && bprev ) {
01856               bprev->exclude_block = 0; 
01857               blk++;
01858             }
01859           }
01860           break;
01861         case 1 :
01862           if( b->start > end_time ) {
01863             state = 2;
01864           }
01865           break;
01866         default:  break;
01867       }
01868 
01869       if( (state == 1) && !b->short_read_ignore ) {
01870         b->exclude_block = 0;
01871         blk++;
01872       } else {
01873         b->exclude_block = 1;
01874       }
01875 
01876       bprev = b;
01877       b = b->next;
01878 
01879     }
01880 
01881   }
01882 
01883   PROFILE_END;
01884 
01885   return( blk );
01886 
01887 }

_LXT2_RD_INLINE int lxt2_rd_set_fac_process_mask ( struct lxt2_rd_trace lt,
lxtint32_t  facidx 
)

References lxt2_rd_trace::process_mask, and lxt2_rd_trace::process_mask_dirty.

01456                                                                                                 {
01457 
01458   int rc = 0;
01459 
01460   if( lt ) {
01461 
01462     lt->process_mask_dirty = 1;
01463 
01464     if( facidx < lt->numfacs ) {
01465       int idx    = facidx / 8;
01466       int bitpos = facidx & 7;
01467       /*@-shiftnegative@*/
01468       lt->process_mask[idx] |= (1 << bitpos);
01469       /*@=shiftnegative@*/
01470     }
01471 
01472     rc = 1;
01473 
01474   }
01475 
01476   return( rc );
01477 
01478 }

_LXT2_RD_INLINE int lxt2_rd_set_fac_process_mask_all ( struct lxt2_rd_trace lt  ) 

References lxt2_rd_trace::numfacs, lxt2_rd_trace::process_mask, and lxt2_rd_trace::process_mask_dirty.

Referenced by lxt_parse().

01505                                                                                  {
01506 
01507   int rc = 0;
01508 
01509   if( lt ) {
01510     lt->process_mask_dirty = 1;
01511     memset( lt->process_mask, 0xff, ((lt->numfacs + 7) / 8) );
01512     rc = 1;
01513   }
01514 
01515   return( rc );
01516 
01517 }

_LXT2_RD_INLINE lxtint64_t lxt2_rd_set_max_block_mem_usage ( struct lxt2_rd_trace lt,
lxtint64_t  block_mem_max 
)

References lxt2_rd_trace::block_mem_max.

Referenced by lxt_parse().

01536                                                                                                                  {
01537 
01538   lxtint64_t rc = lt->block_mem_max;
01539 
01540   lt->block_mem_max = block_mem_max;
01541 
01542   return( rc );
01543 
01544 }

unsigned int lxt2_rd_unlimit_time_range ( struct lxt2_rd_trace lt  ) 
Returns:
Returns the number of active blocks

Unrestricts access to the whole LXT file

Parameters:
lt Pointer to LXT read tracer

References lxt2_rd_trace::block_head, lxt2_rd_block::exclude_block, lxt2_rd_block::next, PROFILE, PROFILE_END, and lxt2_rd_block::short_read_ignore.

01896   { PROFILE(LXT2_RD_UNLIMIT_TIME_RANGE);
01897 
01898   int blk = 0;
01899 
01900   if( lt ) {
01901 
01902     struct lxt2_rd_block *b = lt->block_head;
01903 
01904     while( b ) {
01905       b->exclude_block = 0;
01906       if( !b->short_read_ignore ) {
01907         blk++;
01908       }
01909       b = b->next;
01910     }
01911 
01912   }
01913 
01914   PROFILE_END;
01915 
01916   return( blk );
01917 
01918 }

Generated on Sun Nov 21 00:55:39 2010 for Covered by  doxygen 1.6.3