#include <stdio.h>
#include "defines.h"
#include "lxt2_read.h"
#include "util.h"
#define lxt2_rd_get_byte | ( | mm, | |||
offset | ) | ((unsigned int)(*((unsigned char *)(mm)+(offset)))) |
Referenced by lxt2_rd_get_facname(), lxt2_rd_iter_radix(), lxt2_rd_iter_radix0(), and lxt2_rd_process_block().
static void lxt2_rd_build_radix | ( | struct lxt2_rd_trace * | lt, | |
struct lxt2_rd_block * | b, | |||
int | granule, | |||
lxtint32_t | strtfac, | |||
lxtint32_t | endfac | |||
) | [static] |
anonymous | lxt2_rd_iter_radix0 |
References lxt2_rd_trace::fac_map, LXT2_RD_GRAN_1VAL, LXT2_RD_GRANULE_SIZE, lxt2_rd_iter_radix0(), lxt2_rd_tzc(), lxt2_rd_trace::next_radix, lxt2_rd_trace::process_mask, PROFILE, PROFILE_END, and lxt2_rd_trace::radix_sort.
Referenced by lxt2_rd_process_block().
00533 { PROFILE(LXT2_RD_BUILD_RADIX); 00534 00535 unsigned int i; 00536 int offset; 00537 00538 for( i=0; i<(LXT2_RD_GRANULE_SIZE+1); i++ ) { /* +1 because tzc returns 33/65 when its arg == 0 */ 00539 lt->radix_sort[i] = NULL; /* each one is a linked list: we get fac number based on address of item from lt->next_radix */ 00540 } 00541 00542 for( i=strtfac; i<endfac; i++ ) { 00543 00544 granmsk_t x; 00545 int process_idx = i / 8; 00546 int process_bit = i & 7; 00547 00548 /*@-shiftnegative@*/ 00549 if( lt->process_mask[process_idx] & (1 << process_bit) ) { 00550 /*@=shiftnegative@*/ 00551 00552 if( (x = lt->fac_map[i]) ) { 00553 if( !granule && (x & LXT2_RD_GRAN_1VAL) ) { 00554 lxt2_rd_iter_radix0( lt, b, i ); /* emit vcd only if it's unique */ 00555 x &= ~LXT2_RD_GRAN_1VAL; /* clear out least sig bit */ 00556 lt->fac_map[i] = x; 00557 if( !x ) { 00558 continue; 00559 } 00560 } 00561 offset = lxt2_rd_tzc( x ); /* get "which time" bucket number of new least sig one bit */ 00562 lt->next_radix[i] = lt->radix_sort[offset]; /* insert item into head of radix sorted "which time" buckets */ 00563 lt->radix_sort[offset] = <->next_radix[i]; 00564 } 00565 00566 } 00567 00568 } 00569 00570 PROFILE_END; 00571 00572 }
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 }
static unsigned int lxt2_rd_expand_bits_to_integer | ( | int | len, | |
char * | s | |||
) | [static] |
References PROFILE, and PROFILE_END.
Referenced by lxt2_rd_iter_radix().
00213 { PROFILE(LXT2_RD_EXPAND_BITS_TO_INTEGER); 00214 00215 unsigned int v = 0; 00216 int i; 00217 00218 for( i=0; i<len; i++ ) { 00219 v <<= 1; 00220 v |= ((*s) & 1); 00221 s++; 00222 } 00223 00224 PROFILE_END; 00225 00226 return( v ); 00227 00228 }
static char* lxt2_rd_expand_integer_to_bits | ( | int | len, | |
unsigned int | value | |||
) | [static] |
References PROFILE, and PROFILE_END.
Referenced by lxt2_rd_iter_radix().
00189 { PROFILE(LXT2_RD_EXPAND_INTEGER_TO_BITS); 00190 00191 static char s[33]; 00192 char* p = s; 00193 int i; 00194 int len2 = len - 1; 00195 00196 for( i=0; i<len; i++ ) { 00197 /*@-shiftnegative@*/ 00198 *(p++) = '0' | ((value & (1 << (len2 - i))) != 0); 00199 /*@=shiftnegative@*/ 00200 } 00201 00202 *p = 0; 00203 00204 PROFILE_END; 00205 00206 return( s ); 00207 00208 }
static unsigned int lxt2_rd_get_16 | ( | void * | mm, | |
int | offset | |||
) | [static] |
Referenced by lxt2_rd_get_facname(), lxt2_rd_iter_radix(), lxt2_rd_iter_radix0(), and lxt2_rd_process_block().
static unsigned int lxt2_rd_get_24 | ( | void * | mm, | |
int | offset | |||
) | [static] |
Referenced by lxt2_rd_iter_radix(), lxt2_rd_iter_radix0(), and lxt2_rd_process_block().
static unsigned int lxt2_rd_get_32 | ( | void * | mm, | |
int | offset | |||
) | [static] |
Referenced by lxt2_rd_get_64(), lxt2_rd_iter_radix(), lxt2_rd_iter_radix0(), and lxt2_rd_process_block().
00118 { 00119 00120 unsigned char* nn = (unsigned char*)mm+offset; 00121 unsigned int m1 =* ((unsigned char*)(nn++)); 00122 unsigned int m2 =* ((unsigned char*)(nn++)); 00123 unsigned int m3 =* ((unsigned char*)(nn++)); 00124 unsigned int m4 =* ((unsigned char*)nn); 00125 00126 return( (m1 << 24) | (m2 << 16) | (m3 << 8) | m4 ); 00127 00128 }
static lxtint64_t lxt2_rd_get_64 | ( | void * | mm, | |
int | offset | |||
) | [static] |
References lxt2_rd_get_32().
Referenced by lxt2_rd_process_block().
00130 { 00131 00132 return( (((lxtint64_t)lxt2_rd_get_32( mm, offset )) << 32) | ((lxtint64_t)lxt2_rd_get_32( mm, (offset + 4))) ); 00133 00134 }
_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( <->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().
static void lxt2_rd_iter_radix | ( | struct lxt2_rd_trace * | lt, | |
struct lxt2_rd_block * | b | |||
) | [static] |
anonymous | Throw Throw |
References lxt2_rd_trace::fac_curpos, lxt2_rd_trace::fac_curpos_width, lxt2_rd_trace::fac_map, FATAL, lxt2_rd_trace::flags, free_safe, lxt2_rd_trace::len, LXT2_RD_DICT_START, LXT2_RD_ENC_0, LXT2_RD_ENC_1, LXT2_RD_ENC_ADD1, LXT2_RD_ENC_ADD2, LXT2_RD_ENC_ADD3, LXT2_RD_ENC_ADD4, LXT2_RD_ENC_BLACKOUT, LXT2_RD_ENC_INV, LXT2_RD_ENC_LSH0, LXT2_RD_ENC_LSH1, LXT2_RD_ENC_RSH0, LXT2_RD_ENC_RSH1, 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_expand_bits_to_integer(), lxt2_rd_expand_integer_to_bits(), lxt2_rd_get_16(), lxt2_rd_get_24(), lxt2_rd_get_32(), lxt2_rd_get_byte, LXT2_RD_GRAN_1VAL, LXT2_RD_SYM_F_DOUBLE, LXT2_RD_SYM_F_STRING, lxt2_rd_tzc(), lxt2_rd_trace::next_radix, lxt2_rd_block::num_dict_entries, lxt2_rd_trace::num_time_table_entries, lxt2_rd_trace::prev_time, print_output(), PROFILE, PROFILE_END, lxt2_rd_trace::radix_sort, strdup_safe, lxt2_rd_block::string_lens, lxt2_rd_block::string_pointers, Throw, lxt2_rd_trace::time_table, user_msg, USER_MSG_LENGTH, lxt2_rd_trace::value, and lxt2_rd_trace::value_change_callback.
Referenced by lxt2_rd_process_block().
00241 { PROFILE(LXT2_RD_ITER_RADIX); 00242 00243 unsigned int which_time; 00244 int offset; 00245 void** top_elem; 00246 granmsk_t msk = ~LXT2_RD_GRAN_1VAL; 00247 lxtint32_t x; 00248 00249 for( which_time=0; which_time<lt->num_time_table_entries; which_time++, msk <<= 1 ) { 00250 00251 while( (top_elem = lt->radix_sort[which_time]) ) { 00252 00253 lxtint32_t idx = top_elem - lt->next_radix; 00254 unsigned int vch; 00255 unsigned int i; 00256 00257 switch( lt->fac_curpos_width ) { 00258 case 1 : vch = lxt2_rd_get_byte( lt->fac_curpos[idx], 0 ); break; 00259 case 2 : vch = lxt2_rd_get_16( lt->fac_curpos[idx], 0 ); break; 00260 case 3 : vch = lxt2_rd_get_24( lt->fac_curpos[idx], 0 ); break; 00261 case 4 : 00262 default : vch = lxt2_rd_get_32( lt->fac_curpos[idx], 0 ); break; 00263 } 00264 00265 lt->fac_curpos[idx] += lt->fac_curpos_width; 00266 00267 /* Offset = next "which time" for this fac */ 00268 offset = lxt2_rd_tzc( lt->fac_map[idx] &= msk ); 00269 00270 /* Get next list item for this "which time" bucket */ 00271 lt->radix_sort[which_time] = lt->next_radix[idx]; 00272 00273 /* Promote fac to its next (higher) possible bucket (if any) */ 00274 lt->next_radix[idx] = lt->radix_sort[offset]; 00275 00276 /* ... and put it at the head of that list */ 00277 lt->radix_sort[offset] = <->next_radix[idx]; 00278 00279 switch( vch ) { 00280 case LXT2_RD_ENC_0: 00281 case LXT2_RD_ENC_1: 00282 memset( lt->value[idx], ('0' + (vch - LXT2_RD_ENC_0 )), lt->len[idx] ); 00283 break; 00284 case LXT2_RD_ENC_INV: 00285 for( i=0; i<lt->len[idx]; i++ ) { 00286 lt->value[idx][i] ^= 1; 00287 } 00288 break; 00289 case LXT2_RD_ENC_LSH0: 00290 case LXT2_RD_ENC_LSH1: 00291 memmove( lt->value[idx], (lt->value[idx] + 1), (lt->len[idx] - 1) ); 00292 lt->value[idx][lt->len[idx]-1] = '0' + (vch - LXT2_RD_ENC_LSH0); 00293 break; 00294 case LXT2_RD_ENC_RSH0: 00295 case LXT2_RD_ENC_RSH1: 00296 memmove( (lt->value[idx] + 1), lt->value[idx], (lt->len[idx] - 1) ); 00297 lt->value[idx][0] = '0' + (vch - LXT2_RD_ENC_RSH0); 00298 break; 00299 case LXT2_RD_ENC_ADD1: 00300 case LXT2_RD_ENC_ADD2: 00301 case LXT2_RD_ENC_ADD3: 00302 case LXT2_RD_ENC_ADD4: 00303 x = lxt2_rd_expand_bits_to_integer( lt->len[idx], lt->value[idx] ); 00304 x += (vch - LXT2_RD_ENC_ADD1 + 1); 00305 memcpy( lt->value[idx], lxt2_rd_expand_integer_to_bits( lt->len[idx], x ), lt->len[idx] ); 00306 break; 00307 case LXT2_RD_ENC_SUB1: 00308 case LXT2_RD_ENC_SUB2: 00309 case LXT2_RD_ENC_SUB3: 00310 case LXT2_RD_ENC_SUB4: 00311 x = lxt2_rd_expand_bits_to_integer( lt->len[idx], lt->value[idx] ); 00312 x -= (vch - LXT2_RD_ENC_SUB1 + 1); 00313 memcpy( lt->value[idx], lxt2_rd_expand_integer_to_bits( lt->len[idx], x ), lt->len[idx] ); 00314 break; 00315 case LXT2_RD_ENC_X: 00316 memset( lt->value[idx], 'x', lt->len[idx] ); 00317 break; 00318 case LXT2_RD_ENC_Z: 00319 memset( lt->value[idx], 'z', lt->len[idx] ); 00320 break; 00321 case LXT2_RD_ENC_BLACKOUT: 00322 lt->value[idx][0] = 0; 00323 break; 00324 default: 00325 vch -= LXT2_RD_DICT_START; 00326 if( vch >= b->num_dict_entries ) { 00327 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Internal error: vch(%u) >= num_dict_entries(%u)", vch, (unsigned int)b->num_dict_entries ); 00328 assert( rv < USER_MSG_LENGTH ); 00329 print_output( user_msg, FATAL, __FILE__, __LINE__ ); 00330 Throw 0; 00331 } 00332 if( lt->flags[idx] & (LXT2_RD_SYM_F_DOUBLE | LXT2_RD_SYM_F_STRING) ) { 00333 free_safe( lt->value[idx], (strlen( lt->value[idx] ) + 1) ); 00334 lt->value[idx] = strdup_safe( (char*)b->string_pointers[vch] ); 00335 break; 00336 } 00337 if( lt->len[idx] == b->string_lens[vch] ) { 00338 memcpy( lt->value[idx], b->string_pointers[vch], lt->len[idx] ); 00339 } else if( lt->len[idx] > b->string_lens[vch] ) { 00340 int lendelta = lt->len[idx] - b->string_lens[vch]; 00341 memset( lt->value[idx], ((b->string_pointers[vch][0] != '1') ? b->string_pointers[vch][0] : '0'), lendelta ); 00342 strcpy( (lt->value[idx] + lendelta), (char*)b->string_pointers[vch] ); 00343 } else { 00344 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Internal error: %u ('%s') vs %u ('%s')", 00345 (unsigned int)lt->len[idx], lt->value[idx], (unsigned int)b->string_lens[vch], (char*)b->string_pointers[vch] ); 00346 assert( rv < USER_MSG_LENGTH ); 00347 print_output( user_msg, FATAL, __FILE__, __LINE__ ); 00348 Throw 0; 00349 } 00350 break; 00351 } 00352 00353 if( lt->time_table[which_time] != lt->prev_time ) { 00354 lt->prev_time = lt->time_table[which_time]; 00355 } 00356 00357 lt->value_change_callback(<, <->time_table[which_time], &idx, <->value[idx]); 00358 00359 } 00360 00361 } 00362 00363 PROFILE_END; 00364 00365 }
static void lxt2_rd_iter_radix0 | ( | struct lxt2_rd_trace * | lt, | |
struct lxt2_rd_block * | b, | |||
lxtint32_t | idx | |||
) | [static] |
anonymous | Throw |
References lxt2_rd_trace::fac_curpos, lxt2_rd_trace::fac_curpos_width, FATAL, lxt2_rd_trace::flags, free_safe, lxt2_rd_trace::len, LXT2_RD_DICT_START, LXT2_RD_ENC_0, LXT2_RD_ENC_1, LXT2_RD_ENC_ADD1, LXT2_RD_ENC_ADD2, LXT2_RD_ENC_ADD3, LXT2_RD_ENC_ADD4, LXT2_RD_ENC_BLACKOUT, LXT2_RD_ENC_INV, LXT2_RD_ENC_LSH0, LXT2_RD_ENC_LSH1, LXT2_RD_ENC_RSH0, LXT2_RD_ENC_RSH1, 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_get_16(), lxt2_rd_get_24(), lxt2_rd_get_32(), lxt2_rd_get_byte, LXT2_RD_SYM_F_DOUBLE, LXT2_RD_SYM_F_STRING, lxt2_rd_block::num_dict_entries, lxt2_rd_trace::prev_time, print_output(), PROFILE, PROFILE_END, strdup_safe, lxt2_rd_block::string_lens, lxt2_rd_block::string_pointers, Throw, lxt2_rd_trace::time_table, user_msg, USER_MSG_LENGTH, lxt2_rd_trace::value, and lxt2_rd_trace::value_change_callback.
Referenced by lxt2_rd_build_radix().
00378 { PROFILE(LXT2_RD_ITER_RADIX0); 00379 00380 unsigned int vch; 00381 unsigned int which_time; 00382 unsigned int i; 00383 int uniq = 0; 00384 00385 switch( lt->fac_curpos_width ) { 00386 case 1: vch = lxt2_rd_get_byte( lt->fac_curpos[idx], 0 ); break; 00387 case 2: vch = lxt2_rd_get_16( lt->fac_curpos[idx], 0 ); break; 00388 case 3: vch = lxt2_rd_get_24( lt->fac_curpos[idx], 0 ); break; 00389 case 4: 00390 default: vch = lxt2_rd_get_32( lt->fac_curpos[idx], 0 ); break; 00391 } 00392 00393 lt->fac_curpos[idx] += lt->fac_curpos_width; 00394 which_time = 0; 00395 00396 switch( vch ) { 00397 case LXT2_RD_ENC_0: 00398 for( i=0; i<lt->len[idx]; i++ ) { 00399 if( lt->value[idx][i] != '0' ) { 00400 memset( (lt->value[idx] + i), '0', (lt->len[idx] - i) ); 00401 uniq = 1; 00402 break; 00403 } 00404 } 00405 break; 00406 case LXT2_RD_ENC_1: 00407 for( i=0; i<lt->len[idx]; i++) { 00408 if( lt->value[idx][i] != '1' ) { 00409 memset( (lt->value[idx] + i), '1', (lt->len[idx] - i) ); 00410 uniq = 1; 00411 break; 00412 } 00413 } 00414 break; 00415 case LXT2_RD_ENC_INV: 00416 case LXT2_RD_ENC_LSH0: 00417 case LXT2_RD_ENC_LSH1: 00418 case LXT2_RD_ENC_RSH0: 00419 case LXT2_RD_ENC_RSH1: 00420 case LXT2_RD_ENC_ADD1: 00421 case LXT2_RD_ENC_ADD2: 00422 case LXT2_RD_ENC_ADD3: 00423 case LXT2_RD_ENC_ADD4: 00424 case LXT2_RD_ENC_SUB1: 00425 case LXT2_RD_ENC_SUB2: 00426 case LXT2_RD_ENC_SUB3: 00427 case LXT2_RD_ENC_SUB4: 00428 print_output( "Internal error in granule 0 position 0", FATAL, __FILE__, __LINE__ ); 00429 Throw 0; 00430 /*@-unreachable@*/ 00431 break; 00432 /*@=unreachable@*/ 00433 case LXT2_RD_ENC_X: 00434 for( i=0; i<lt->len[idx]; i++ ) { 00435 if( lt->value[idx][i] != 'x' ) { 00436 memset( (lt->value[idx] + i), 'x', (lt->len[idx] - i) ); 00437 uniq = 1; 00438 break; 00439 } 00440 } 00441 break; 00442 case LXT2_RD_ENC_Z: 00443 for( i=0; i<lt->len[idx]; i++ ) { 00444 if( lt->value[idx][i] != 'z' ) { 00445 memset( (lt->value[idx] + i), 'z', (lt->len[idx] - i) ); 00446 uniq = 1; 00447 break; 00448 } 00449 } 00450 break; 00451 case LXT2_RD_ENC_BLACKOUT: 00452 if( lt->value[idx] ) { 00453 lt->value[idx][0] = 0; 00454 uniq = 1; 00455 } 00456 break; 00457 default: 00458 vch -= LXT2_RD_DICT_START; 00459 if( vch >= b->num_dict_entries ) { 00460 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Internal error: vch(%u) >= num_dict_entries(%u)", vch, (unsigned int)b->num_dict_entries ); 00461 assert( rv < USER_MSG_LENGTH ); 00462 print_output( user_msg, FATAL, __FILE__, __LINE__ ); 00463 Throw 0; 00464 } 00465 if( lt->flags[idx] & (LXT2_RD_SYM_F_DOUBLE | LXT2_RD_SYM_F_STRING) ) { 00466 if( strcmp( lt->value[idx], (char*)b->string_pointers[vch] ) ) { 00467 free_safe( lt->value[idx], ((lt->len[idx] + 1) * sizeof( char )) ); 00468 lt->value[idx] = strdup_safe( (char*)b->string_pointers[vch] ); 00469 uniq = 1; 00470 } 00471 break; 00472 } 00473 if( lt->len[idx] == b->string_lens[vch] ) { 00474 for( i=0; i<lt->len[idx]; i++ ) { 00475 if( lt->value[idx][i] != b->string_pointers[vch][i] ) { 00476 memcpy( (lt->value[idx] + i), (b->string_pointers[vch] + i), (lt->len[idx] - i) ); 00477 uniq = 1; 00478 } 00479 } 00480 } else if( lt->len[idx] > b->string_lens[vch] ) { 00481 unsigned int lendelta = lt->len[idx] - b->string_lens[vch]; 00482 int fill = (b->string_pointers[vch][0] != '1') ? b->string_pointers[vch][0] : '0'; 00483 for( i=0; i<lendelta; i++ ) { 00484 if( lt->value[idx][i] != fill ) { 00485 memset( (lt->value[idx] + i), fill, (lendelta - i) ); 00486 strcpy( (lt->value[idx] + lendelta), (char*)b->string_pointers[vch] ); 00487 uniq = 1; 00488 goto fini; 00489 } 00490 } 00491 for( i=lendelta; i<lt->len[idx]; i++ ) { 00492 if( lt->value[idx][i] != b->string_pointers[vch][i-lendelta] ) { 00493 memcpy( (lt->value[idx] + i), (b->string_pointers[vch] + i - lendelta), (lt->len[idx] - i) ); 00494 uniq = 1; 00495 } 00496 } 00497 } else { 00498 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Internal error: %u ('%s') vs %u ('%s')", 00499 (unsigned int)lt->len[idx], lt->value[idx], (unsigned int)b->string_lens[vch], (char*)b->string_pointers[vch] ); 00500 assert( rv < USER_MSG_LENGTH ); 00501 print_output( user_msg, FATAL, __FILE__, __LINE__ ); 00502 Throw 0; 00503 } 00504 break; 00505 } 00506 00507 fini: 00508 if( uniq ) { 00509 if( lt->time_table[which_time] != lt->prev_time ) { 00510 lt->prev_time = lt->time_table[which_time]; 00511 } 00512 lt->value_change_callback( <, <->time_table[which_time], &idx, <->value[idx] ); 00513 } 00514 00515 PROFILE_END; 00516 00517 }
unsigned int lxt2_rd_limit_time_range | ( | struct lxt2_rd_trace * | lt, | |
lxtint64_t | strt_time, | |||
lxtint64_t | end_time | |||
) |
Limits access to a given timerange in the LXT file
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 }
static void lxt2_rd_null_callback | ( | struct lxt2_rd_trace ** | lt, | |
lxtint64_t * | pnt_time, | |||
lxtint32_t * | pnt_facidx, | |||
char ** | pnt_value | |||
) | [static] |
Referenced by lxt2_rd_process_block(), and lxt2_rd_tzc().
static int lxt2_rd_process_block | ( | struct lxt2_rd_trace * | lt, | |
struct lxt2_rd_block * | b | |||
) | [static] |
anonymous | lxt2_rd_build_radix lxt2_rd_iter_radix Throw Throw Throw Throw |
References lxt2_rd_block::dict_start, lxt2_rd_trace::fac_curpos, lxt2_rd_trace::fac_curpos_width, lxt2_rd_trace::fac_map, lxt2_rd_trace::fac_map_index_width, FATAL, free_safe, get_fac_msk, lxt2_rd_trace::granule_size, lxt2_rd_build_radix(), lxt2_rd_get_16(), lxt2_rd_get_24(), lxt2_rd_get_32(), lxt2_rd_get_64(), lxt2_rd_get_byte, LXT2_RD_GRAN_SECT_DICT, LXT2_RD_GRAN_SECT_TIME, LXT2_RD_GRAN_SECT_TIME_PARTIAL, LXT2_RD_GRANULE_SIZE, lxt2_rd_iter_radix(), lxt2_rd_ones_cnt(), LXT2_RD_PARTIAL_SIZE, lxt2_rd_regenerate_process_mask(), malloc_safe_nolimit, lxt2_rd_block::map_start, lxt2_rd_block::mem, lxt2_rd_block::num_dict_entries, lxt2_rd_block::num_map_entries, lxt2_rd_trace::num_time_table_entries, lxt2_rd_trace::numrealfacs, print_output(), lxt2_rd_trace::process_mask_compressed, PROFILE, PROFILE_END, lxt2_rd_block::string_lens, lxt2_rd_block::string_pointers, Throw, lxt2_rd_trace::time_table, lxt2_rd_block::uncompressed_siz, user_msg, and USER_MSG_LENGTH.
00632 { PROFILE(LXT2_RD_PROCESS_BLOCK); 00633 00634 char vld; 00635 unsigned char* pnt; 00636 unsigned int i; 00637 int granule = 0; 00638 char sect_typ; 00639 lxtint32_t strtfac_gran = 0; 00640 char granvld = 0; 00641 00642 b->num_map_entries = lxt2_rd_get_32( b->mem, (b->uncompressed_siz - 4) ); 00643 b->num_dict_entries = lxt2_rd_get_32( b->mem, (b->uncompressed_siz - 12) ); 00644 00645 #if LXT2_RD_GRANULE_SIZE > 32 00646 if( lt->granule_size == LXT2_RD_GRANULE_SIZE ) { 00647 b->map_start = (b->mem + b->uncompressed_siz - 12) - sizeof( granmsk_t ) * b->num_map_entries; 00648 } else { 00649 b->map_start = (b->mem + b->uncompressed_siz - 12) - sizeof( granmsk_smaller_t ) * b->num_map_entries; 00650 } 00651 #else 00652 b->map_start = (b->mem + b->uncompressed_siz - 12) - sizeof( granmsk_t ) * b->num_map_entries; 00653 #endif 00654 00655 b->dict_start = b->map_start - lxt2_rd_get_32( b->mem, (b->uncompressed_siz - 8) ); 00656 00657 vld = lxt2_rd_get_byte( (b->dict_start - 1), 0 ); 00658 00659 if( vld != LXT2_RD_GRAN_SECT_DICT ) { 00660 print_output( "Malformed section", FATAL, __FILE__, __LINE__ ); 00661 Throw 0; 00662 } 00663 00664 if( b->num_dict_entries ) { 00665 b->string_pointers = malloc_safe_nolimit( b->num_dict_entries * sizeof( char* ) ); 00666 b->string_lens = malloc_safe_nolimit( b->num_dict_entries * sizeof( unsigned int ) ); 00667 pnt = b->dict_start; 00668 for( i=0; i<b->num_dict_entries; i++ ) { 00669 b->string_pointers[i] = pnt; 00670 b->string_lens[i] = strlen( (char*)pnt ); 00671 pnt += (b->string_lens[i] + 1); 00672 } 00673 if( pnt != b->map_start ) { 00674 print_output( "Dictionary corrupt, exiting...", FATAL, __FILE__, __LINE__ ); 00675 free_safe( b->string_pointers, (b->num_dict_entries * sizeof( char* )) ); 00676 free_safe( b->string_lens, (b->num_dict_entries * sizeof( unsigned int )) ); 00677 Throw 0; 00678 } 00679 } 00680 00681 pnt = b->mem; 00682 00683 while( ((sect_typ=*pnt) == LXT2_RD_GRAN_SECT_TIME) || (sect_typ == LXT2_RD_GRAN_SECT_TIME_PARTIAL) ) { 00684 00685 lxtint32_t strtfac, endfac; 00686 00687 if( sect_typ == LXT2_RD_GRAN_SECT_TIME_PARTIAL ) { 00688 00689 lxtint32_t sublen; 00690 00691 lxt2_rd_regenerate_process_mask( lt ); 00692 strtfac = lxt2_rd_get_32( pnt, 1 ); 00693 sublen = lxt2_rd_get_32( pnt, 5 ); 00694 00695 if( !granvld ) { 00696 granvld = 1; 00697 strtfac_gran = strtfac; 00698 } else { 00699 granule += (strtfac == strtfac_gran); 00700 } 00701 00702 if( !lt->process_mask_compressed[strtfac/LXT2_RD_PARTIAL_SIZE] ) { 00703 pnt += 9; 00704 pnt += sublen; 00705 continue; 00706 } 00707 00708 endfac = strtfac + LXT2_RD_PARTIAL_SIZE; 00709 00710 if( endfac > lt->numrealfacs ) { 00711 endfac = lt->numrealfacs; 00712 } 00713 00714 pnt += 8; 00715 00716 } else { 00717 00718 strtfac = 0; 00719 endfac = lt->numrealfacs; 00720 00721 } 00722 00723 pnt++; 00724 lt->num_time_table_entries = lxt2_rd_get_byte( pnt, 0 ); 00725 pnt++; 00726 for( i=0; i<lt->num_time_table_entries; i++ ) { 00727 lt->time_table[i] = lxt2_rd_get_64( pnt, 0 ); 00728 pnt += 8; 00729 } 00730 00731 lt->fac_map_index_width = lxt2_rd_get_byte( pnt, 0 ); 00732 if( !lt->fac_map_index_width || (lt->fac_map_index_width > 4) ) { 00733 /*@-formatcode@*/ 00734 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Map index width of %hhu is illegal, exiting...", lt->fac_map_index_width ); 00735 /*@=formatcode@*/ 00736 assert( rv < USER_MSG_LENGTH ); 00737 print_output( user_msg, FATAL, __FILE__, __LINE__ ); 00738 Throw 0; 00739 } 00740 pnt++; 00741 00742 for( i=strtfac; i<endfac; i++ ) { 00743 00744 lxtint32_t mskindx; 00745 00746 switch( lt->fac_map_index_width ) { 00747 case 1 : mskindx = lxt2_rd_get_byte( pnt, 0 ); break; 00748 case 2 : mskindx = lxt2_rd_get_16( pnt, 0 ); break; 00749 case 3 : mskindx = lxt2_rd_get_24( pnt, 0 ); break; 00750 case 4 : 00751 default: mskindx = lxt2_rd_get_32( pnt, 0 ); break; 00752 } 00753 00754 pnt += lt->fac_map_index_width; 00755 00756 #if LXT2_RD_GRANULE_SIZE > 32 00757 if( lt->granule_size==LXT2_RD_GRANULE_SIZE ) { 00758 lt->fac_map[i] = get_fac_msk( b->map_start, (mskindx * sizeof( granmsk_t )) ); 00759 } else { 00760 lt->fac_map[i] = get_fac_msk_smaller( b->map_start, (mskindx * sizeof( granmsk_smaller_t )) ); 00761 } 00762 #else 00763 lt->fac_map[i] = get_fac_msk( b->map_start, (mskindx * sizeof( granmsk_t )) ); 00764 #endif 00765 00766 } 00767 00768 lt->fac_curpos_width = lxt2_rd_get_byte( pnt, 0 ); 00769 if( !lt->fac_curpos_width || (lt->fac_curpos_width > 4) ) { 00770 /*@-formatcode@*/ 00771 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Curpos index width of %hhu is illegal, exiting...", lt->fac_curpos_width ); 00772 /*@=formatcode@*/ 00773 assert( rv < USER_MSG_LENGTH ); 00774 print_output( user_msg, FATAL, __FILE__, __LINE__ ); 00775 Throw 0; 00776 } 00777 pnt++; 00778 00779 for( i=strtfac; i<endfac; i++ ) { 00780 lt->fac_curpos[i] = pnt; 00781 if( lt->fac_map[i] ) { 00782 pnt += (lxt2_rd_ones_cnt( lt->fac_map[i] ) * lt->fac_curpos_width); 00783 } 00784 } 00785 00786 lxt2_rd_build_radix( lt, b, granule, strtfac, endfac ); 00787 lxt2_rd_iter_radix( lt, b ); 00788 00789 if( sect_typ != LXT2_RD_GRAN_SECT_TIME_PARTIAL ) { 00790 granule++; 00791 } 00792 00793 } 00794 00795 PROFILE_END; 00796 00797 return( 1 ); 00798 00799 }
static void lxt2_rd_regenerate_process_mask | ( | struct lxt2_rd_trace * | lt | ) | [static] |
References LXT2_RD_PARTIAL_SIZE, lxt2_rd_trace::numrealfacs, lxt2_rd_trace::process_mask, lxt2_rd_trace::process_mask_compressed, lxt2_rd_trace::process_mask_dirty, PROFILE, and PROFILE_END.
Referenced by lxt2_rd_process_block().
00581 { PROFILE(LXT2_RD_REGENERATE_PROCESS_MASK); 00582 00583 unsigned int i, j, lim, idx; 00584 00585 if( lt && lt->process_mask_dirty ) { 00586 00587 lt->process_mask_dirty = 0; 00588 idx = 0; 00589 00590 for( i=0; i<lt->numrealfacs; i+=LXT2_RD_PARTIAL_SIZE ) { 00591 00592 if( (i + LXT2_RD_PARTIAL_SIZE) > lt->numrealfacs ) { 00593 lim = lt->numrealfacs; 00594 } else { 00595 lim = i + LXT2_RD_PARTIAL_SIZE; 00596 } 00597 00598 lt->process_mask_compressed[idx] = 0; 00599 for( j=i; j<lim; j++ ) { 00600 int process_idx = j / 8; /* no need to optimize this */ 00601 int process_bit = j & 7; 00602 /*@-shiftnegative@*/ 00603 if( lt->process_mask[process_idx] & (1 << process_bit) ) { 00604 /*@=shiftnegative@*/ 00605 lt->process_mask_compressed[idx] = 1; 00606 break; 00607 } 00608 } 00609 00610 idx++; 00611 00612 } 00613 00614 } 00615 00616 PROFILE_END; 00617 00618 }
_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 }
References LXT2_RD_GRAN_1VAL, and lxt2_rd_ones_cnt().
Referenced by lxt2_rd_build_radix(), and lxt2_rd_iter_radix().
00177 { 00178 return( lxt2_rd_ones_cnt( (x & -x) - LXT2_RD_GRAN_1VAL ) ); 00179 }
unsigned int lxt2_rd_unlimit_time_range | ( | struct lxt2_rd_trace * | lt | ) |
Unrestricts access to the whole LXT file
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 }
If set to TRUE, causes debug information to be spewed to screen.
char user_msg[USER_MSG_LENGTH] |
Holds some output that will be displayed via the print_output command. This is created globally so that memory does not need to be reallocated for each function that wishes to use it.