Changeset 14187


Ignore:
Timestamp:
Nov 26, 2019 9:21:29 PM (10 days ago)
Author:
Christian Andersson
Message:

Updated debug messages from the external evaluator. Related to ticket:5872

Location:
branches/dev-cw-2641/Compiler/ModelicaFrontEnd/src/java/org/jmodelica/common/evaluation
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-cw-2641/Compiler/ModelicaFrontEnd/src/java/org/jmodelica/common/evaluation/ExternalFunction.java

    r13246 r14187  
    1212public interface ExternalFunction<K, V> {
    1313
     14    public static final String EXTERNAL_LOG_PREFIX = "[EXTERNAL_EVALUATION] ";
     15   
    1416    public int evaluate(External<K> ext, Map<K, V> values, int timeout) throws IOException;
    1517
  • branches/dev-cw-2641/Compiler/ModelicaFrontEnd/src/java/org/jmodelica/common/evaluation/ExternalFunctionImpl.java

    r13826 r14187  
    3939    @Override
    4040    public int evaluate(External<K> ext, Map<K, V> values, int timeout) throws IOException {
    41         compiler.log().debug("Evaluating compiled external function: " + ext.getName());
     41        compiler.log().debug(ExternalFunction.EXTERNAL_LOG_PREFIX+"Evaluating compiled external function: " + ext.getName());
    4242        ProcessCommunicator<V, T> com = null;
    4343        try {
  • branches/dev-cw-2641/Compiler/ModelicaFrontEnd/src/java/org/jmodelica/common/evaluation/ExternalProcessCacheImpl.java

    r13790 r14187  
    3636
    3737    private final ExternalFunctionCompiler<K, E> mc;
     38   
     39    private String addDebugInfoPrefix(String msg) {
     40        return ExternalFunction.EXTERNAL_LOG_PREFIX + msg;
     41    }
    3842
    3943    public ExternalProcessCacheImpl(ExternalFunctionCompiler<K, E> mc) {
     
    116120                sharedLibrary = "NoSharedLibrary";
    117121            } else {
    118                 mc.log().debug("Could not find a shared library containing '" + functionName + "'. Disabling use of the evaluator...");
     122                mc.log().debug(addDebugInfoPrefix("Could not find a shared library containing '" + functionName + "'. Disabling use of the evaluator..."));
    119123                return false;
    120124            }
     
    122126       
    123127        if (!supportedSignatures.contains(outputArguments+"+"+inputArguments)) {
    124             mc.log().debug("The function signature, outputs '" + outputArguments + "', inputs '" + inputArguments + "', is not supported. Disabling use of the evaluator...");
     128            mc.log().debug(addDebugInfoPrefix("The function signature, outputs '" + outputArguments + "', inputs '" + inputArguments + "', is not supported. Disabling use of the evaluator..."));
    125129            return false;
    126130        }
     
    156160                    extFunctionExecutable = new ExternalFunctionExecutableDynamic(arguments);
    157161                   
    158                     debugMsg = "Succesfully connected external function '" + ext.getName() + "' to the evaluator '"
    159                             + executable + "' with outputs: '" + ext.functionReturnArgSerialized() + "' and inputs: '" + ext.functionArgsSerialized() + "'";
     162                    debugMsg = "Succesfully connected external function '" + ext.getName() + "' to the evaluator";
    160163                } else {
    161164                    executable = mc.compileExternal(ext);
     
    164167                   
    165168                    debugMsg = "Succesfully compiled external function '" + ext.getName() + "' to executable '"
    166                             + executable + "' code for evaluation";
     169                            + executable + "'";
    167170                }
    168171               
     
    173176                }
    174177                time = System.currentTimeMillis() - time;
    175                 mc.log().debug(debugMsg +", time: " + time + "ms");
     178                mc.log().debug(addDebugInfoPrefix(debugMsg +", time: " + time + "ms"));
    176179            } catch (FileNotFoundException e) {
    177                 ef = FailedExternalFunction.<K,V,T,E>failedEval(mc, ext, "c-code generation failed '" + e.getMessage() + "'", true);
    178                 mc.log().debug(ef.getMessage());
     180                ef = FailedExternalFunction.<K,V,T,E>failedEval(mc, ext, addDebugInfoPrefix("c-code generation failed '" + e.getMessage() + "'"), true);
     181                mc.log().info(ef.getMessage());
    179182            } catch (CcodeCompilationException e) {
    180                 ef = FailedExternalFunction.<K,V,T,E>failedEval(mc, ext, "c-code compilation failed '" + e.getMessage() + "'", true);
    181                 mc.log().debug(ef.getMessage());
    182                 e.printStackTrace(new PrintStream(mc.log().debugStream()));
     183                ef = FailedExternalFunction.<K,V,T,E>failedEval(mc, ext, addDebugInfoPrefix("c-code compilation failed '" + e.getMessage() + "'"), true);
     184                mc.log().info(ef.getMessage());
     185                e.printStackTrace(new PrintStream(mc.log().infoStream()));
    183186            }
    184187            cachedExternals.put(ext.getName(), ef);
  • branches/dev-cw-2641/Compiler/ModelicaFrontEnd/src/java/org/jmodelica/common/evaluation/FailedExternalFunction.java

    r13719 r14187  
    3030    public int evaluate(External<K> ext, Map<K, V> values, int timeout) throws IOException {
    3131        if (log) {
    32             logContainer.log().debug("Evaluating failed external function: " + ext.getName());
     32            logContainer.log().debug(ExternalFunction.EXTERNAL_LOG_PREFIX + "Evaluating failed external function: " + ext.getName());
    3333        }
    3434        throw new ConstantEvaluationException(null, getMessage());
  • branches/dev-cw-2641/Compiler/ModelicaFrontEnd/src/java/org/jmodelica/common/evaluation/LiveExternalFunction.java

    r13826 r14187  
    3838    @Override
    3939    public int evaluate(External<K> ext, Map<K, V> values, int timeout) throws IOException {
    40         compiler.log().debug("Evaluating live external function: " + ext.getName());
     40        compiler.log().debug(ExternalFunction.EXTERNAL_LOG_PREFIX+"Evaluating live external function: " + ext.getName());
    4141        try {
    4242            ready(ext, values, timeout);
     
    4444            map.evaluate(ext, values, timeout, com);
    4545            time = System.currentTimeMillis() - time;
    46             compiler.log().debug("Finished evaluating live external function, time: " + time + "ms");
     46            compiler.log().debug(ExternalFunction.EXTERNAL_LOG_PREFIX+"Finished evaluating live external function, time: " + time + "ms");
    4747        } catch (ProcessCommunicator.AbortConstantEvaluationException e) {
    4848            // TODO What does this mean?
Note: See TracChangeset for help on using the changeset viewer.