scripts/extractGLRMRuntimeJavaLog.py
def extractRunInto(javaLogText):
    """
    This function will extract the various operation time for GLRM model building iterations.

    :param javaLogText:
    :return:
    """
    global g_initialXY
    global g_reguarlize_Y
    global g_regularize_X_objective
    global g_updateX
    global g_updateY
    global g_objective
    global g_stepsize
    global g_history


    if os.path.isfile(javaLogText):

        run_result = dict()
        run_result["total time (ms)"] = []
        run_result["initialXY (ms)"] = []
        run_result["regularize Y (ms)"] = []
        run_result["regularize X and objective (ms)"] = []
        run_result["update X (ms)"] = []
        run_result["update Y (ms)"] = []
        run_result["objective (ms)"] = []
        run_result["step size (ms)"] = []
        run_result["update history (ms)"] = []

        total_run_time = -1
        val = 0.0
        with open(javaLogText, 'r') as thefile:   # go into tempfile and grab test run info
            for each_line in thefile:
                temp_string = each_line.split()

                if len(temp_string) > 0:
                    val = temp_string[-1].replace('\\','')

                if g_initialXY in each_line:    # start of a new file
                    if total_run_time > 0:  # update total run time
                        run_result["total time (ms)"].append(total_run_time)
                        total_run_time = 0.0
                    else:
                        total_run_time = 0.0

                    run_result["initialXY (ms)"].append(float(val))
                    total_run_time = total_run_time+float(val)

                if g_reguarlize_Y in each_line:
                    run_result["regularize Y (ms)"].append(float(val))
                    total_run_time = total_run_time+float(val)

                if g_regularize_X_objective in each_line:
                    run_result["regularize X and objective (ms)"].append(float(val))
                    total_run_time = total_run_time+float(val)

                if g_updateX in each_line:
                    run_result["update X (ms)"].append(float(val))
                    total_run_time = total_run_time+float(val)

                if g_updateY in each_line:
                    run_result["update Y (ms)"].append(float(val))
                    total_run_time = total_run_time+float(val)

                if g_objective in each_line:
                    run_result["objective (ms)"].append(float(val))
                    total_run_time = total_run_time+float(val)

                if g_stepsize in each_line:
                    run_result["step size (ms)"].append(float(val))
                    total_run_time = total_run_time+float(val)

                if g_history in each_line:
                    run_result["update history (ms)"].append(float(val))
                    total_run_time = total_run_time+float(val)

        run_result["total time (ms)"].append(total_run_time)    # save the last one
        print("Run result summary: \n {0}".format(run_result))

    else:
        print("Cannot find your java log file.  Nothing is done.\n")
def extractRunInto(javaLogText):
    global g_initialXY
    global g_reguarlize_Y
    global g_regularize_X_objective
    global g_updateX
    global g_updateY
    global g_objective
    global g_stepsize
    global g_history


    if os.path.isfile(javaLogText):

        run_result = dict()
        run_result["total time (ms)"] = []
        run_result["initialXY (ms)"] = []
        run_result["regularize Y (ms)"] = []
        run_result["regularize X and objective (ms)"] = []
        run_result["update X (ms)"] = []
        run_result["update Y (ms)"] = []
        run_result["objective (ms)"] = []
        run_result["step size (ms)"] = []
        run_result["update history (ms)"] = []

        total_run_time = -1
        val = 0.0
        with open(javaLogText, 'r') as thefile:   # go into tempfile and grab test run info
            for each_line in thefile:
                temp_string = each_line.split()

                if len(temp_string) > 0:
                    val = temp_string[-1].replace('\\','')

                if g_initialXY in each_line:    # start of a new file
                    if total_run_time > 0:  # update total run time
                        run_result["total time (ms)"].append(total_run_time)
                        total_run_time = 0.0
                    else:
                        total_run_time = 0.0

                    run_result["initialXY (ms)"].append(float(val))
                    total_run_time = total_run_time+float(val)

                if g_reguarlize_Y in each_line:
                    run_result["regularize Y (ms)"].append(float(val))
                    total_run_time = total_run_time+float(val)

                if g_regularize_X_objective in each_line:
                    run_result["regularize X and objective (ms)"].append(float(val))
                    total_run_time = total_run_time+float(val)

                if g_updateX in each_line:
                    run_result["update X (ms)"].append(float(val))
                    total_run_time = total_run_time+float(val)

                if g_updateY in each_line:
                    run_result["update Y (ms)"].append(float(val))
                    total_run_time = total_run_time+float(val)

                if g_objective in each_line:
                    run_result["objective (ms)"].append(float(val))
                    total_run_time = total_run_time+float(val)

                if g_stepsize in each_line:
                    run_result["step size (ms)"].append(float(val))
                    total_run_time = total_run_time+float(val)

                if g_history in each_line:
                    run_result["update history (ms)"].append(float(val))
                    total_run_time = total_run_time+float(val)

        run_result["total time (ms)"].append(total_run_time)    # save the last one
        print("Run result summary: \n {0}".format(run_result))

    else:
        print("Cannot find your java log file.  Nothing is done.\n")
def extractRunInto ( javaLogText ) : global g_initialXY global g_reguarlize_Y global g_regularize_X_objective global g_updateX global g_updateY global g_objective global g_stepsize global g_history if os . path . isfile ( javaLogText ) : run_result = dict ( ) run_result [ "total time (ms)" ] = [ ] run_result [ "initialXY (ms)" ] = [ ] run_result [ "regularize Y (ms)" ] = [ ] run_result [ "regularize X and objective (ms)" ] = [ ] run_result [ "update X (ms)" ] = [ ] run_result [ "update Y (ms)" ] = [ ] run_result [ "objective (ms)" ] = [ ] run_result [ "step size (ms)" ] = [ ] run_result [ "update history (ms)" ] = [ ] total_run_time = - 1 val = 0.0 with open ( javaLogText , 'r' ) as thefile : # go into tempfile and grab test run info for each_line in thefile : temp_string = each_line . split ( ) if len ( temp_string ) > 0 : val = temp_string [ - 1 ] . replace ( '\\' , '' ) if g_initialXY in each_line : # start of a new file if total_run_time > 0 : # update total run time run_result [ "total time (ms)" ] . append ( total_run_time ) total_run_time = 0.0 else : total_run_time = 0.0 run_result [ "initialXY (ms)" ] . append ( float ( val ) ) total_run_time = total_run_time + float ( val ) if g_reguarlize_Y in each_line : run_result [ "regularize Y (ms)" ] . append ( float ( val ) ) total_run_time = total_run_time + float ( val ) if g_regularize_X_objective in each_line : run_result [ "regularize X and objective (ms)" ] . append ( float ( val ) ) total_run_time = total_run_time + float ( val ) if g_updateX in each_line : run_result [ "update X (ms)" ] . append ( float ( val ) ) total_run_time = total_run_time + float ( val ) if g_updateY in each_line : run_result [ "update Y (ms)" ] . append ( float ( val ) ) total_run_time = total_run_time + float ( val ) if g_objective in each_line : run_result [ "objective (ms)" ] . append ( float ( val ) ) total_run_time = total_run_time + float ( val ) if g_stepsize in each_line : run_result [ "step size (ms)" ] . append ( float ( val ) ) total_run_time = total_run_time + float ( val ) if g_history in each_line : run_result [ "update history (ms)" ] . append ( float ( val ) ) total_run_time = total_run_time + float ( val ) run_result [ "total time (ms)" ] . append ( total_run_time ) # save the last one print ( "Run result summary: \n {0}" . format ( run_result ) ) else : print ( "Cannot find your java log file.  Nothing is done.\n" )
This function will extract the various operation time for GLRM model building iterations.

    :param javaLogText:
    :return:
This function will extract the various operation time for GLRM model building iterations .