- Implement DS_Index_Check_I() & DS_Index_Info_Print_I API,
- Implement in dsbench: Index_List_SubType_Set, Index_Tree_SubType_Set, Index_Info_Print & Index_Value_Break commands, - Add in DS_Value_Find dsbench command the repeat arg.
This commit is contained in:
parent
56d502faab
commit
32d95032b0
@ -251,8 +251,10 @@ typedef struct DST_RootDescZ
|
|||||||
|
|
||||||
# define DS_Index_Open DS_Index_Open_I
|
# define DS_Index_Open DS_Index_Open_I
|
||||||
# define DS_Index_Close DS_Index_Close_I
|
# define DS_Index_Close DS_Index_Close_I
|
||||||
# define DS_Index_Convert DS_Index_Convert_I
|
|
||||||
# define DS_Index_Reorg DS_Index_Reorg_I
|
# define DS_Index_Reorg DS_Index_Reorg_I
|
||||||
|
# define DS_Index_Check DS_Index_Check_I
|
||||||
|
# define DS_Index_Convert DS_Index_Convert_I
|
||||||
|
# define DS_Index_Info_Print DS_Index_Info_Print_I
|
||||||
|
|
||||||
# define DS_Node_Root_Get DS_Node_Root_Get_I
|
# define DS_Node_Root_Get DS_Node_Root_Get_I
|
||||||
# define DS_Node_First_Get DS_Node_First_Get_I
|
# define DS_Node_First_Get DS_Node_First_Get_I
|
||||||
@ -300,8 +302,10 @@ typedef struct DST_RootDescZ
|
|||||||
|
|
||||||
# define DS_Index_Open DS_Index_Open_L
|
# define DS_Index_Open DS_Index_Open_L
|
||||||
# define DS_Index_Close DS_Index_Close_L
|
# define DS_Index_Close DS_Index_Close_L
|
||||||
# define DS_Index_Convert DS_Index_Convert_L
|
|
||||||
# define DS_Index_Reorg DS_Index_Reorg_L
|
# define DS_Index_Reorg DS_Index_Reorg_L
|
||||||
|
# define DS_Index_Check DS_Index_Check_L
|
||||||
|
# define DS_Index_Convert DS_Index_Convert_L
|
||||||
|
# define DS_Index_Info_Print DS_Index_Info_Print_L
|
||||||
|
|
||||||
# define DS_Node_Root_Get DS_Node_Root_Get_L
|
# define DS_Node_Root_Get DS_Node_Root_Get_L
|
||||||
# define DS_Node_First_Get DS_Node_First_Get_L
|
# define DS_Node_First_Get DS_Node_First_Get_L
|
||||||
@ -347,8 +351,10 @@ typedef struct DST_RootDescZ
|
|||||||
|
|
||||||
# define DS_Index_Open DS_Index_Open_CL
|
# define DS_Index_Open DS_Index_Open_CL
|
||||||
# define DS_Index_Close DS_Index_Close_CL
|
# define DS_Index_Close DS_Index_Close_CL
|
||||||
# define DS_Index_Convert DS_Index_Convert_CL
|
|
||||||
# define DS_Index_Reorg DS_Index_Reorg_CL
|
# define DS_Index_Reorg DS_Index_Reorg_CL
|
||||||
|
# define DS_Index_Check DS_Index_Check_CL
|
||||||
|
# define DS_Index_Convert DS_Index_Convert_CL
|
||||||
|
# define DS_Index_Info_Print DS_Index_Info_Print_CL
|
||||||
|
|
||||||
# define DS_Node_Root_Get DS_Node_Root_Get_CL
|
# define DS_Node_Root_Get DS_Node_Root_Get_CL
|
||||||
# define DS_Node_First_Get DS_Node_First_Get_CL
|
# define DS_Node_First_Get DS_Node_First_Get_CL
|
||||||
@ -666,6 +672,24 @@ DSD_API DST_Status DS_Index_Close_CL( DST_Root *Root_Ptr, NDT_Index_Id Index_
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Check & repare a data structure index: */
|
||||||
|
/* - Check & fix node links */
|
||||||
|
/* - Update data structure statistics */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root_Ptr: Data structure pointer */
|
||||||
|
/* (I) Index_Id: Id of the index */
|
||||||
|
/* (O) Error_Dectected_Nb_Ptr: Number of error detected pointer */
|
||||||
|
/* (O) Error_Corrected_Nb_Ptr: Number of error corected pointer */
|
||||||
|
/* (I) Out: Output stream */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
DSD_API DST_Status DS_Index_Check_I( DST_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Error_Dectected_Nb_Ptr, int *Error_Corrected_Nb_Ptr, FILE *Out);
|
||||||
|
DSD_API DST_Status DS_Index_Check_L( DST_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Error_Dectected_Nb_Ptr, int *Error_Corrected_Nb_Ptr, FILE *Out);
|
||||||
|
DSD_API DST_Status DS_Index_Check_CL( DST_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Error_Dectected_Nb_Ptr, int *Error_Corrected_Nb_Ptr, FILE *Out);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
/* Convert a data structure index to another type */
|
/* Convert a data structure index to another type */
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
@ -695,6 +719,23 @@ DSD_API DST_Status DS_Index_Reorg_CL( DST_Root *Root_Ptr, NDT_Index_Id Index_
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Print data structure index information */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Stream: Output stream */
|
||||||
|
/* (I) Root_Ptr: Data structure pointer */
|
||||||
|
/* (I) Index_Id: Id of the index */
|
||||||
|
/* (I) Recursive_Mode: Child or Parent */
|
||||||
|
/* (I) Recursive_Depth: Curent recursion depth */
|
||||||
|
/* (I) Recursive_Offset: Curent print out offset */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
DSD_API DST_Status DS_Index_Info_Print_I( FILE *Out, DST_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Recursive_Mode Recursive_Mode, NDT_Recursive_Depth Recursive_Depth, NDT_Recursive_Offset Recursive_Offset);
|
||||||
|
DSD_API DST_Status DS_Index_Info_Print_L( FILE *Out, DST_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Recursive_Mode Recursive_Mode, NDT_Recursive_Depth Recursive_Depth, NDT_Recursive_Offset Recursive_Offset);
|
||||||
|
DSD_API DST_Status DS_Index_Info_Print_CL( FILE *Out, DST_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Recursive_Mode Recursive_Mode, NDT_Recursive_Depth Recursive_Depth, NDT_Recursive_Offset Recursive_Offset);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
/* Récupération du premier noeud d'une structure */
|
/* Récupération du premier noeud d'une structure */
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
@ -1635,6 +1635,39 @@ DST_Status DS_Index_Close_I( DST_Root *Root_Ptr, NDT_Index_Id Index_Id)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Check & repare a data structure index: */
|
||||||
|
/* - Check & fix node links */
|
||||||
|
/* - Update data structure statistics */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root_Ptr: Data structure pointer */
|
||||||
|
/* (I) Index_Id: Id of the index */
|
||||||
|
/* (O) Error_Dectected_Nb_Ptr: Number of error detected pointer */
|
||||||
|
/* (O) Error_Corrected_Nb_Ptr: Number of error corected pointer */
|
||||||
|
/* (I) Out: Output stream */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
DST_Status DS_Index_Check_I( DST_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Error_Dectected_Nb_Ptr, int *Error_Corrected_Nb_Ptr, FILE *Out)
|
||||||
|
{
|
||||||
|
NDT_Status nd_status;
|
||||||
|
|
||||||
|
|
||||||
|
if( ( nd_status = ND_Index_Check_I( &( Root_Ptr->ND_Root), Index_Id, Error_Dectected_Nb_Ptr, Error_Corrected_Nb_Ptr, Out)) != NDS_OK)
|
||||||
|
{
|
||||||
|
LG_LOG_ERROR_2( "Unable to convert index: (%d), status: (%d)", Index_Id, nd_status);
|
||||||
|
|
||||||
|
return( DSS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return( DSS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
/* Convert a data structure index to another type */
|
/* Convert a data structure index to another type */
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
@ -1694,6 +1727,38 @@ DST_Status DS_Index_Reorg_I( DST_Root *Root_Ptr, NDT_Index_Id Index_Id)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Print data structure index information */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Stream: Output stream */
|
||||||
|
/* (I) Root_Ptr: Data structure pointer */
|
||||||
|
/* (I) Index_Id: Id of the index */
|
||||||
|
/* (I) Recursive_Mode: Child or Parent */
|
||||||
|
/* (I) Recursive_Depth: Curent recursion depth */
|
||||||
|
/* (I) Recursive_Offset: Curent print out offset */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
DST_Status DS_Index_Info_Print_I( FILE *Out, DST_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Recursive_Mode Recursive_Mode, NDT_Recursive_Depth Recursive_Depth, NDT_Recursive_Offset Recursive_Offset)
|
||||||
|
{
|
||||||
|
NDT_Status nd_status;
|
||||||
|
|
||||||
|
|
||||||
|
if( ( nd_status = ND_Index_Info_Print( Out, &( Root_Ptr->ND_Root), Index_Id, Recursive_Mode, Recursive_Depth, Recursive_Offset)) != NDS_OK)
|
||||||
|
{
|
||||||
|
LG_LOG_ERROR_1( "Unable to print info about the data structure: (%d)", nd_status);
|
||||||
|
|
||||||
|
return( DSS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return( DSS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
/* Récupération du premier noeud d'une structure */
|
/* Récupération du premier noeud d'une structure */
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
173
util/dsbench.c
173
util/dsbench.c
@ -695,20 +695,39 @@ void Command_Get( int *choice, char **Arg1, char **Arg2, char **Arg3, FILE
|
|||||||
buf[ strlen( buf) - 1] = '\0';
|
buf[ strlen( buf) - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( isdigit( *buf))
|
if( buf[0] == '#')
|
||||||
{
|
{
|
||||||
*choice = atoi( buf);
|
*choice = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( *choice = 0; ( *choice < COMMAND_NB) && ( strncmp( buf, Command_Tab[*choice].Name, strlen(Command_Tab[*choice].Name))) ; (*choice)++);
|
if( isdigit( *buf))
|
||||||
|
{
|
||||||
|
*choice = atoi( buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for( *choice = 0; ( *choice < COMMAND_NB) && ( strncmp( buf, Command_Tab[*choice].Name, strlen(Command_Tab[*choice].Name))) ; (*choice)++);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( *choice < 0) || ( *choice >= COMMAND_NB))
|
if( ( *choice < 0) || ( *choice >= COMMAND_NB))
|
||||||
{
|
{
|
||||||
if( strlen( buf) != 0) fprintf( File_Output, "\nUndefined choice (%s) !\n",buf);
|
if( *choice == -1)
|
||||||
|
{
|
||||||
|
LG_LOG_INFO_1( "Skipping commented out line: [%s]", buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// if( strlen( buf) != 0) fprintf( File_Output, "\nUndefined choice (%s) !\n", buf);
|
||||||
|
if( strlen( buf) != 0)
|
||||||
|
{
|
||||||
|
LG_LOG_ERROR_1( "Undefined choice: [%s]", buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
*choice = -1;
|
||||||
|
}
|
||||||
|
|
||||||
*choice = -1;
|
|
||||||
*Arg1 = NULL;
|
*Arg1 = NULL;
|
||||||
*Arg2 = NULL;
|
*Arg2 = NULL;
|
||||||
*Arg3 = NULL;
|
*Arg3 = NULL;
|
||||||
@ -854,7 +873,7 @@ void Command_Index_Range_Get( FILE *File_Output, int *Low, int *High, char
|
|||||||
void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, char *Arg1, char *Arg2, char *Arg3, FILE *File_Input)
|
void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, char *Arg1, char *Arg2, char *Arg3, FILE *File_Input)
|
||||||
{
|
{
|
||||||
DST_Status status;
|
DST_Status status;
|
||||||
int sub_choice_int1, sub_choice_int2, low, high, i, j, inc, nb_removed, nb_detected, nb_corrected;
|
int sub_choice_int1, sub_choice_int2, low, high, number, i, j, inc, nb_removed, nb_detected, nb_corrected;
|
||||||
char *sub_choice_str;
|
char *sub_choice_str;
|
||||||
T_Module ref_module, *module_ptr;
|
T_Module ref_module, *module_ptr;
|
||||||
char buf[ BUF_SIZE], local_arg1[ BUF_SIZE], local_arg2[ BUF_SIZE], local_arg3[ BUF_SIZE];
|
char buf[ BUF_SIZE], local_arg1[ BUF_SIZE], local_arg2[ BUF_SIZE], local_arg3[ BUF_SIZE];
|
||||||
@ -1166,20 +1185,28 @@ void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
|
|||||||
|
|
||||||
case DS_VALUE_FIND:
|
case DS_VALUE_FIND:
|
||||||
{
|
{
|
||||||
|
int repeat;
|
||||||
|
|
||||||
|
|
||||||
Command_Index_Range_Get( File_Output, &low, &high, Arg1, Arg2, File_Input, Choice, "Search");
|
Command_Index_Range_Get( File_Output, &low, &high, Arg1, Arg2, File_Input, Choice, "Search");
|
||||||
|
|
||||||
if( low != -1)
|
if( low != -1)
|
||||||
{
|
{
|
||||||
LG_LOG_INFO_2( "DS_Value_Find: from: (%d) to: (%d)...", low, high);
|
if( Arg3 == NULL)
|
||||||
|
{
|
||||||
|
DBD_ARG_READ( Arg3, local_arg3, "Repeat #: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
repeat = atoi( Arg3);
|
||||||
|
|
||||||
i = low;
|
LG_LOG_INFO_3( "DS_Value_Find: from: (%d) to: (%d) repeat: (%d)...", low, high, repeat);
|
||||||
j = high + 1;
|
|
||||||
|
number = ( high - low + 1) * repeat;
|
||||||
|
|
||||||
t_start( t_exec);
|
t_start( t_exec);
|
||||||
|
|
||||||
while( i < j)
|
for( i = 0; i < number; i++)
|
||||||
{
|
{
|
||||||
ref_module.Id = low + (int)( (double)( high - low) * rand() / ( RAND_MAX + 1.0));
|
ref_module.Id = low + (int)( (double)( high - low) * rand() / ( RAND_MAX + 1.0));
|
||||||
|
|
||||||
if( DS_DataStruct_Value_Find( (void *)&module_ptr, *DS_Ptr_Ptr, &ref_module) != DSS_OK)
|
if( DS_DataStruct_Value_Find( (void *)&module_ptr, *DS_Ptr_Ptr, &ref_module) != DSS_OK)
|
||||||
@ -1188,15 +1215,11 @@ void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
t_stop (t_exec);
|
t_stop( t_exec);
|
||||||
|
|
||||||
Command_Exec_End_Print( File_Output, Choice, t_exec, high - low);
|
Command_Exec_End_Print( File_Output, Choice, t_exec, number);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -1285,22 +1308,22 @@ void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
case INDEX_LIST_SUBTYPE_SET:
|
case INDEX_LIST_SUBTYPE_SET:
|
||||||
{
|
{
|
||||||
int subtype;
|
int subtype;
|
||||||
|
|
||||||
|
|
||||||
Command_Index_Range_Get( File_Output, &low, &high, Arg1, File_Input, Choice, "Index");
|
Command_Index_Range_Get( File_Output, &low, &high, Arg1, Arg2, File_Input, Choice, "Index");
|
||||||
|
|
||||||
if( low != -1)
|
if( low != -1)
|
||||||
{
|
{
|
||||||
if( Arg2 == NULL)
|
if( Arg3 == NULL)
|
||||||
{
|
{
|
||||||
fprintf( File_Output, "Index_List_SubType_Set: List SubType ( 0:FIFO | 1:LIFO | 2:Sorted) ? ");
|
fprintf( File_Output, "Index_List_SubType_Set: List SubType: ( 0:FIFO | 1:LIFO | 2:Sorted): ");
|
||||||
fgets( buf, BUF_LEN, File_Input);
|
fgets( buf, BUF_LEN, File_Input);
|
||||||
|
|
||||||
Arg2 = buf;
|
Arg3 = buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
subtype = atoi( Arg2);
|
subtype = atoi( Arg2);
|
||||||
@ -1328,27 +1351,27 @@ void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
index_subtype = NDD_INDEX_SUBTYPE_UNKNOWN;
|
index_subtype = NDD_INDEX_SUBTYPE_UNKNOWN;
|
||||||
printf ("Index_List_SubType_Set: Invalid selection (%d) !\n", subtype);
|
|
||||||
|
LG_LOG_ERROR_1( "Invalid list subtype: (%d)", subtype);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( index_subtype != NDD_INDEX_SUBTYPE_UNKNOWN)
|
if( index_subtype != NDD_INDEX_SUBTYPE_UNKNOWN)
|
||||||
{
|
{
|
||||||
// fprintf( File_Output, "Index_List_SubType_Set: Setting List SubType to: (%d) (%s) !\n", index_subtype, ND_INDEX_SUBTYPE_VALUE_ASCII_GET( index_subtype));
|
LG_LOG_INFO_2( "Index_List_SubType_Set: Setting List SubType to: (%d) [%s]", index_subtype, ND_INDEX_SUBTYPE_VALUE_ASCII_GET( index_subtype));
|
||||||
LG_LOG_INFO_2( "Index_List_SubType_Set: Setting List SubType to: (%d) (%s) !", index_subtype, ND_INDEX_SUBTYPE_VALUE_ASCII_GET( index_subtype));
|
|
||||||
|
|
||||||
t_start( t_exec);
|
t_start( t_exec);
|
||||||
|
|
||||||
for( i = low; i <= high; i++)
|
for( i = low; i <= high; i++)
|
||||||
{
|
{
|
||||||
if( ND_INDEX_TYPE_LIST_IS( *DS_Ptr_Ptr, i))
|
if( ND_INDEX_TYPE_LIST_IS( &( ( *DS_Ptr_Ptr)->ND_Root), i))
|
||||||
{
|
{
|
||||||
(*DS_Ptr_Ptr)->Index_Tab[i].Type = ( (*DS_Ptr_Ptr)->Index_Tab[i].Type & NDD_INDEX_SUBTYPE_RMSK) | index_subtype;
|
( *DS_Ptr_Ptr)->ND_Root.Index_Tab[i].Type = ( (*DS_Ptr_Ptr)->ND_Root.Index_Tab[i].Type & NDD_INDEX_SUBTYPE_RMSK) | index_subtype;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf( File_Output, "Index_List_SubType_Set: Error: index (%d) is not a List !\n", i);
|
LG_LOG_ERROR_1( "Index: (%d) is not a list", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1366,19 +1389,19 @@ void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
|
|||||||
int subtype;
|
int subtype;
|
||||||
|
|
||||||
|
|
||||||
Command_Index_Range_Get( File_Output, &low, &high, Arg1, File_Input, Choice, "Index");
|
Command_Index_Range_Get( File_Output, &low, &high, Arg1, Arg2, File_Input, Choice, "Index");
|
||||||
|
|
||||||
if( low != -1)
|
if( low != -1)
|
||||||
{
|
{
|
||||||
if( Arg2 == NULL)
|
if( Arg3 == NULL)
|
||||||
{
|
{
|
||||||
fprintf( File_Output, "Index_Tree_SubType_Set: Tree SubType (0:UnBalanced | 1:Balanced) ? ");
|
fprintf( File_Output, "Index_Tree_SubType_Set: Tree SubType (0:UnBalanced | 1:Balanced): ");
|
||||||
fgets( buf, BUF_LEN, stdin);
|
fgets( buf, BUF_LEN, stdin);
|
||||||
|
|
||||||
Arg2 = buf;
|
Arg3 = buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
subtype = atoi( Arg2);
|
subtype = atoi( Arg3);
|
||||||
|
|
||||||
switch( subtype)
|
switch( subtype)
|
||||||
{
|
{
|
||||||
@ -1397,7 +1420,8 @@ void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
index_subtype = NDD_INDEX_SUBTYPE_UNKNOWN;
|
index_subtype = NDD_INDEX_SUBTYPE_UNKNOWN;
|
||||||
printf ("Index_Tree_SubType_Set: Invalid selection (%d)!\n", subtype);
|
|
||||||
|
LG_LOG_ERROR_1( "Invalid tree subtype: (%d)", subtype);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1409,13 +1433,13 @@ void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
|
|||||||
|
|
||||||
for( i = low; i <= high; i++)
|
for( i = low; i <= high; i++)
|
||||||
{
|
{
|
||||||
if( ND_INDEX_TYPE_TREE_IS( *DS_Ptr_Ptr, i))
|
if( ND_INDEX_TYPE_TREE_IS( &( ( *DS_Ptr_Ptr)->ND_Root), i))
|
||||||
{
|
{
|
||||||
(*DS_Ptr_Ptr)->Index_Tab[i].Type = ( (*DS_Ptr_Ptr)->Index_Tab[i].Type & NDD_INDEX_SUBTYPE_RMSK) | index_subtype;
|
(*DS_Ptr_Ptr)->ND_Root.Index_Tab[i].Type = ( (*DS_Ptr_Ptr)->ND_Root.Index_Tab[i].Type & NDD_INDEX_SUBTYPE_RMSK) | index_subtype;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf( File_Output, "Index_Tree_SubType_Set: Error: index (%d) is not a Tree !\n", i);
|
LG_LOG_ERROR_1( "Index: (%d) is not a tree", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1427,7 +1451,7 @@ void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
case INDEX_REORG:
|
case INDEX_REORG:
|
||||||
{
|
{
|
||||||
Command_Index_Range_Get( File_Output, &low, &high, Arg1, Arg2, File_Input, Choice, "Index");
|
Command_Index_Range_Get( File_Output, &low, &high, Arg1, Arg2, File_Input, Choice, "Index");
|
||||||
@ -1511,21 +1535,18 @@ void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
case INDEX_INFO_PRINT:
|
case INDEX_INFO_PRINT:
|
||||||
{
|
{
|
||||||
Command_Index_Range_Get( File_Output, &low, &high, Arg1, File_Input, Choice, "Index");
|
Command_Index_Range_Get( File_Output, &low, &high, Arg1, Arg2, File_Input, Choice, "Index");
|
||||||
|
|
||||||
if( low != -1)
|
if( low != -1)
|
||||||
{
|
{
|
||||||
// fprintf( File_Output, "Index_Info_Print: Printing index from: (%d) to: (%d)...\n", low, high);
|
|
||||||
// fflush( File_Output);
|
|
||||||
|
|
||||||
LG_LOG_INFO_2( "Index_Info_Print: Printing index from: (%d) to: (%d)...", low, high);
|
LG_LOG_INFO_2( "Index_Info_Print: Printing index from: (%d) to: (%d)...", low, high);
|
||||||
|
|
||||||
for( i = low; i <= high; i++)
|
for( i = low; i <= high; i++)
|
||||||
{
|
{
|
||||||
ND_Index_Info_Print( File_Output, *DS_Ptr_Ptr, (NDT_Index_Id)i, NDD_RECURSIVE_MODE_PARENT_CHILD, 99, 0);
|
DS_Index_Info_Print( File_Output, *DS_Ptr_Ptr, (NDT_Index_Id)i, NDD_RECURSIVE_MODE_PARENT_CHILD, 99, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1534,12 +1555,9 @@ void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
|
|||||||
|
|
||||||
case INDEX_VALUE_PRINT:
|
case INDEX_VALUE_PRINT:
|
||||||
{
|
{
|
||||||
// fprintf( File_Output, "DS_Value_Print:\n");
|
|
||||||
// fflush( File_Output);
|
|
||||||
|
|
||||||
LG_LOG_INFO_0( "DS_Value_Print:");
|
LG_LOG_INFO_0( "DS_Value_Print:");
|
||||||
|
|
||||||
ND_DataStruct_Value_Print( File_Output, *DS_Ptr_Ptr, NDD_RECURSIVE_MODE_PARENT_CHILD, 99, 0);
|
DS_DataStruct_Value_Print( File_Output, *DS_Ptr_Ptr, NDD_RECURSIVE_MODE_PARENT_CHILD, 99, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1549,28 +1567,23 @@ void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
|
|||||||
NDT_Node *node_ptr;
|
NDT_Node *node_ptr;
|
||||||
|
|
||||||
|
|
||||||
Command_Index_Range_Get( File_Output, &low, &high, Arg1, File_Input, Choice, "Index");
|
Command_Index_Range_Get( File_Output, &low, &high, Arg1, Arg2, File_Input, Choice, "Index");
|
||||||
|
|
||||||
if( low != -1)
|
if( low != -1)
|
||||||
{
|
{
|
||||||
if( Arg2 == NULL)
|
if( Arg3 == NULL)
|
||||||
{
|
{
|
||||||
fprintf( File_Output, "Index_Value_Break: Value position (0:Head | 1:Tail | 2:Random) ? ");
|
fprintf( File_Output, "Index_Value_Break: Value position (0:Head | 1:Tail | 2:Random): ");
|
||||||
fgets( buf, BUF_LEN, stdin);
|
fgets( buf, BUF_LEN, stdin);
|
||||||
|
|
||||||
Arg2 = buf;
|
Arg3 = buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
position = atoi( Arg2);
|
position = atoi( Arg3);
|
||||||
|
|
||||||
// fprintf( File_Output, "Index_Value_Break: Breaking %s values from index : (%d) to: (%d)...\n",
|
|
||||||
// ( position == 0 ) ? "Head" : ( ( position == 1) ? "Tail" : "Random"),
|
|
||||||
// low, high);
|
|
||||||
// fflush( File_Output);
|
|
||||||
|
|
||||||
LG_LOG_INFO_3( "Index_Value_Break: Breaking: (%s) values from index: (%d) to: (%d)...",
|
LG_LOG_INFO_3( "Index_Value_Break: Breaking: (%s) values from index: (%d) to: (%d)...",
|
||||||
( position == 0 ) ? "Head" : ( ( position == 1) ? "Tail" : "Random"),
|
( position == 0 ) ? "Head" : ( ( position == 1) ? "Tail" : "Random"),
|
||||||
low, high);
|
low, high);
|
||||||
|
|
||||||
t_start( t_exec);
|
t_start( t_exec);
|
||||||
|
|
||||||
@ -1583,21 +1596,21 @@ void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
node_ptr =(*DS_Ptr_Ptr)->Index_Tab[i].Head;
|
node_ptr =(*DS_Ptr_Ptr)->ND_Root.Index_Tab[i].Head;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
node_ptr=(*DS_Ptr_Ptr)->Index_Tab[i].Tail;
|
node_ptr=(*DS_Ptr_Ptr)->ND_Root.Index_Tab[i].Tail;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
j = (int)( (double)( (*DS_Ptr_Ptr)->Index_Tab[i].Node_Number) * rand() / ( RAND_MAX + 1.0));
|
j = (int)( (double)( (*DS_Ptr_Ptr)->ND_Root.Index_Tab[i].Node_Number) * rand() / ( RAND_MAX + 1.0));
|
||||||
|
|
||||||
for( node_ptr = (*DS_Ptr_Ptr)->Index_Tab[i].Head; j > 0; j--)
|
for( node_ptr = (*DS_Ptr_Ptr)->ND_Root.Index_Tab[i].Head; j > 0; j--)
|
||||||
{
|
{
|
||||||
node_ptr = node_ptr->Right;
|
node_ptr = node_ptr->Right;
|
||||||
}
|
}
|
||||||
@ -1606,34 +1619,31 @@ void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fprintf( File_Output, "0x(%x)", node_ptr);
|
LG_LOG_INFO_1( "Index_Value_Break: Breaking value of node: (%p)", node_ptr);
|
||||||
// fflush( File_Output);
|
|
||||||
|
|
||||||
LG_LOG_INFO_1( "Index_Value_Break: Breaking value of node: 0x(%x)", node_ptr);
|
|
||||||
|
|
||||||
node_ptr->Value = (void *)-1;
|
node_ptr->Value = (void *)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
t_stop (t_exec);
|
t_stop (t_exec);
|
||||||
|
|
||||||
fprintf( File_Output, "\n");
|
// fprintf( File_Output, "\n");
|
||||||
fflush( File_Output);
|
// fflush( File_Output);
|
||||||
|
|
||||||
Command_Exec_End_Print( File_Output, Choice, t_exec, high - low);
|
Command_Exec_End_Print( File_Output, Choice, t_exec, high - low);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
case INDEX_NODE_BREAK:
|
case INDEX_NODE_BREAK:
|
||||||
{
|
{
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
case INDEX_CHECK:
|
case INDEX_CHECK:
|
||||||
{
|
{
|
||||||
Command_Index_Range_Get( File_Output, &low, &high, Arg1, File_Input, Choice, "Index");
|
Command_Index_Range_Get( File_Output, &low, &high, Arg1, Arg2, File_Input, Choice, "Index");
|
||||||
|
|
||||||
if( low != -1)
|
if( low != -1)
|
||||||
{
|
{
|
||||||
@ -1641,15 +1651,11 @@ void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
|
|||||||
|
|
||||||
for( i = low; i <= high; i++)
|
for( i = low; i <= high; i++)
|
||||||
{
|
{
|
||||||
// fprintf( File_Output, "Index_Check: Checking Index (%d)...\n", i);
|
|
||||||
// fprintf( File_Output, "Index_Check: ");
|
|
||||||
// fflush( File_Output);
|
|
||||||
|
|
||||||
LG_LOG_INFO_1( "Index_Check: Checking Index (%d)...", i);
|
LG_LOG_INFO_1( "Index_Check: Checking Index (%d)...", i);
|
||||||
LG_LOG_INFO_0( "Index_Check: ");
|
LG_LOG_INFO_0( "Index_Check: ");
|
||||||
|
|
||||||
Nb_Corrected = Nb_Detected = 0;
|
nb_corrected = nb_detected = 0;
|
||||||
ND_Index_Check( *DS_Ptr_Ptr, (NDT_Index_Id)i, &Nb_Detected, &Nb_Corrected, File_Output);
|
DS_Index_Check( *DS_Ptr_Ptr, (NDT_Index_Id)i, &nb_detected, &nb_corrected, File_Output);
|
||||||
}
|
}
|
||||||
|
|
||||||
t_stop (t_exec);
|
t_stop (t_exec);
|
||||||
@ -1659,7 +1665,7 @@ void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
case BATCH_RUN:
|
case BATCH_RUN:
|
||||||
{
|
{
|
||||||
FILE *file_input;
|
FILE *file_input;
|
||||||
@ -1678,20 +1684,15 @@ void Command_Exec( DST_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
|
|||||||
|
|
||||||
if( file_input == NULL)
|
if( file_input == NULL)
|
||||||
{
|
{
|
||||||
// fprintf( File_Output, "Batch_Run: Can't open file (%s)!\n", Arg1);
|
|
||||||
LG_LOG_ERROR_1( "Batch_Run: Can't open file (%s)!", Arg1);
|
LG_LOG_ERROR_1( "Batch_Run: Can't open file (%s)!", Arg1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// fprintf( File_Output, "\n\n--------------------------------------------------------------------------------\n");
|
|
||||||
// fprintf( File_Output, "Batch_Run: Starting execution (%s)...\n", Arg1);
|
|
||||||
LG_LOG_INFO_0( "--------------------------------------------------------------------------------");
|
LG_LOG_INFO_0( "--------------------------------------------------------------------------------");
|
||||||
LG_LOG_INFO_1( "Batch_Run: Starting execution (%s)...", Arg1);
|
LG_LOG_INFO_1( "Batch_Run: Starting execution (%s)...", Arg1);
|
||||||
|
|
||||||
Batch_Run( DS_Ptr_Ptr, File_Output, file_input, 0);
|
Batch_Run( DS_Ptr_Ptr, File_Output, file_input, 0);
|
||||||
|
|
||||||
// fprintf( File_Output, "\n");
|
|
||||||
// fprintf( File_Output, "Batch_Run: Ending execution (%s)...\n", Arg1);
|
|
||||||
LG_LOG_INFO_1( "Batch_Run: Ending execution (%s)...", Arg1);
|
LG_LOG_INFO_1( "Batch_Run: Ending execution (%s)...", Arg1);
|
||||||
|
|
||||||
fclose( file_input);
|
fclose( file_input);
|
||||||
@ -1807,7 +1808,7 @@ int main( int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LG_LOG_INFO_0( "End NDBench");
|
LG_LOG_INFO_0( "End DSBench");
|
||||||
|
|
||||||
if( ( lg_status = LG_Library_Close( true)) != LGS_OK)
|
if( ( lg_status = LG_Library_Close( true)) != LGS_OK)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user