/**
@SYMTestCaseID			PDS-STORE-UT-4055
@SYMTestCaseDesc		Test for DEF141471 - STORE, new stream performance tests.
						PREQ2505 Insturmentation of PDS.
						RMemWriteStream & RMemReadStream performance tests.
@SYMTestPriority		High
@SYMTestActions			Test for DEF141471 - STORE, new stream performance tests.
@SYMTestExpectedResults Test must not fail
@SYMDEF					DEF141471
*/
void MemStreamTestL()
	{
	HBufC8* buf = HBufC8::NewLC(KBufSize);
	TPtr8 bufPtr = buf->Des();

	//RMemWriteStream::Open()	
	RMemWriteStream strm1;
	TUint32 fc = User::FastCounter();
	strm1.Open(const_cast <TUint8*> (bufPtr.Ptr()), KBufSize);
	TUint32 openFc = CalcTickDiff(fc, User::FastCounter());
	PrintFcDiffAsUs(_L("###  RMemWriteStream::Open(), Time=%d us\r\n"), openFc);
	strm1.Close();
	
	//RMemWriteStream::RMemWriteStream(TAny*,...)	
	fc = User::FastCounter();
	RMemWriteStream strm2(const_cast <TUint8*> (bufPtr.Ptr()), KBufSize);
	TUint32 constrFc = CalcTickDiff(fc, User::FastCounter());
	PrintFcDiffAsUs(_L("###  RMemWriteStream::RMemWriteStream(TAny*,...), Time=%d us\r\n"), constrFc);
	CleanupClosePushL(strm2);
	DoStreamWriteTestL(strm2);
	CleanupStack::PopAndDestroy(&strm2);
	
	//RMemReadStream::Open()
	RMemReadStream strm3;
	fc = User::FastCounter();
	strm3.Open(bufPtr.Ptr(), KBufSize);
	openFc = CalcTickDiff(fc, User::FastCounter());
	PrintFcDiffAsUs(_L("###  RMemReadStream::Open(), Time=%d us\r\n"), openFc);
	strm3.Close();

	//RMemReadStream::RMemReadStream(TAny*,...)	
	fc = User::FastCounter();
	RMemReadStream strm4(bufPtr.Ptr(), KBufSize);
	constrFc = CalcTickDiff(fc, User::FastCounter());
	PrintFcDiffAsUs(_L("###  RMemReadStream::RMemReadStream(TAny*,...), Time=%d us\r\n"), openFc);
	CleanupClosePushL(strm4);
	DoStreamReadTestL(strm4);
	CleanupStack::PopAndDestroy(&strm4);
	
	CleanupStack::PopAndDestroy(buf);
	}
示例#2
0
Alignment * interactive_domain_extraction ( Constraint_list *CL)
{
    int LEN=0;
    int START=1;
    int SCALE=2;
    int GOPP=3;

    int iteration=0;
    char *choice;
    int a,b, c;
    int index;
    char *s;
    char last_start[100];
    char out_format[100];
    Alignment *RESULT=NULL;
    Alignment *PREVIOUS=NULL;
    Alignment *C=NULL;
    Alignment *EA=NULL;

    int **parameters;


    choice=(char*)vcalloc ( 100, sizeof (char));
    parameters=declare_int (10000, 4);

    parameters[0][START]=(CL->moca)->moca_start;
    parameters[0][LEN]=  (CL->moca)->moca_len;
    parameters[0][SCALE]=(CL->moca)->moca_scale;
    parameters[0][GOPP]=CL->gop;
    iteration=0;
    sprintf ( last_start, "%d", (CL->moca)->moca_start);
    sprintf ( out_format, "mocca_aln");

    print_moca_interactive_choices ();
    while ( !strm4 (choice, "Q","X", "q", "x" ))
    {
        c=choice[0];

        if (c=='b' || c=='B')
        {
            iteration-=atoi(choice+1)+1;

            if (iteration<0)iteration=1;
        }
        else
        {
            iteration++;
            parameters[iteration][START]=parameters[iteration-1][START];
            parameters[iteration][LEN]=parameters[iteration-1][LEN];
            parameters[iteration][SCALE]=parameters[iteration-1][SCALE];
            parameters[iteration][GOPP]=parameters[iteration-1][GOPP];

            if ( c=='>')parameters[iteration][LEN]=atoi(choice+1);
            else if ( c=='|')
            {
                sprintf ( last_start, "%s", choice);
                parameters[iteration][START]=0;
                s=strrchr(choice, ':');

                if (s==NULL)
                {
                    parameters[iteration][START]=atoi(choice+1);
                }
                else
                {

                    s[0]='\0';

                    if((index=name_is_in_list (choice+1,(CL->S)->name,(CL->S)->nseq,100))==-1)
                    {
                        fprintf ( stderr, "\n\tERROR: %s NOT in Sequence Set",choice+1);
                        continue;
                    }

                    for ( a=0; a< index; a++)
                    {
                        parameters[iteration][START]+=(CL->S)->len[a]+1;
                    }
                    parameters[iteration][START]+=atoi(s+1)-1;
                }

            }
            else if ( c=='C'||c=='c')parameters[iteration][SCALE]=atoi(choice+1);
            else if ( c=='G'||c=='g')
            {
                parameters[iteration][GOPP]=atoi(choice+1);
                CL->gop=parameters[iteration][GOPP];
            }
            else if (  c=='F'||c=='f')
            {
                sprintf ( out_format, "%s", choice+1);
            }
            else if ( c=='S'||c=='s')
            {
                if (choice[1]=='\0')sprintf ( choice, "default.domain_aln.%d", iteration);
                output_format_aln (out_format,RESULT,EA=fast_coffee_evaluate_output(RESULT, CL),choice+1);
                fprintf (stderr, "\tOutput  file [%15s] in [%10s] format\n",choice+1,out_format);
                free_aln (EA);
            }
            else if (c=='\0')
            {
                if ( parameters[iteration][SCALE]>0)
                {
                    fprintf ( stderr, "\nWARNING: THRESHOLD RESET to 0");
                    parameters[iteration][SCALE]=0;
                }

                (CL->moca)->moca_scale=parameters[iteration][SCALE];
                CL->gop=parameters[iteration][GOPP];

                C=extract_domain_with_coordinates (C,parameters[iteration][START],parameters[iteration][LEN],CL);

                if ( C==NULL)
                {
                    fprintf ( stderr, "\nERROR: ILLEGAL COORDINATES! SEQUENCE BOUNDARY CROSSED\n");
                    for ( b=1,a=0; a< (CL->S)->nseq-1; a++)
                    {

                        fprintf ( stderr, "\n\t%15s=> Abs:[%d %d] Rel:[0 %d]", (CL->S)->name[a],b, b+(CL->S)->len[a]-1,(CL->S)->len[a]);
                        b+=(CL->S)->len[a];
                    }
                    fprintf ( stderr, "\n");
                }
                else if (parameters[iteration][START]==0 && parameters[iteration][LEN]==0)
                {
                    fprintf ( stderr, "\n\tEnter the following parameters:\n\n\t\tSTART  value: |x [Return]\n\t\tLENgth value: >y [Return]\n\t\ttype             [Return]\n\n");
                    fprintf ( stderr, "\n\n\tSTART is measured on the total length of the concatenated sequences\n\tx and y are positive integers\n\n");
                }

                else if ( C->nseq==0)
                {
                    fprintf ( stderr, "\nNO MATCH FOUND: LOWER THE SCALE (C)\n");
                }
                else
                {
                    RESULT=copy_aln ( C, RESULT);
                    unpack_seq_aln (RESULT, CL);
                    RESULT->output_res_num=1;

                    output_format_aln (out_format,RESULT,EA=fast_coffee_evaluate_output(RESULT, CL),"stdout");
                    free_aln(EA);
                    PREVIOUS=copy_aln ( RESULT, PREVIOUS);
                    free_aln (C);
                    print_moca_interactive_choices ();

                }
            }

            fprintf ( stderr, "\t[ITERATION %3d][START=%s][LEN=%3d][GOPP=%3d][SCALE=%4d]\t",iteration,last_start,parameters[iteration][LEN],parameters[iteration][GOPP],parameters[iteration][SCALE]);
            a=0;
            fprintf ( stderr, "Your Choice: ");
            while ( (c=fgetc(stdin))!='\n')choice[a++]=c;
            choice[a]=0;
        }
    }

    if (!RESULT)myexit(EXIT_SUCCESS);
    if ( RESULT)RESULT->output_res_num=0;
    return RESULT;
}