private static void writeFileStart(PrintWriter writer, SampleSaveConfiguration saveConfig) { if (saveConfig.saveAsXml()) { writer.print(XML_HEADER); // Write the EOL separately so we generate LF line ends on Unix and Windows writer.print("\n"); // $NON-NLS-1$ String pi=saveConfig.getXmlPi(); if (pi.length() > 0) { writer.println(pi); } // Can't do it as a static initialisation, because SaveService // is being constructed when this is called writer.print(TESTRESULTS_START_V1_1_PREVER); writer.print(SaveService.getVERSION()); writer.print(TESTRESULTS_START_V1_1_POSTVER); // Write the EOL separately so we generate LF line ends on Unix and Windows writer.print("\n"); // $NON-NLS-1$ } else if (saveConfig.saveFieldNames()) { writer.println(CSVSaveService.printableFieldNamesToString(saveConfig)); } }
public static void doBestCSVSetup(SampleSaveConfiguration conf) { conf.setAsXml(false); conf.setFieldNames(true); conf.setSamplerData(false); conf.setRequestHeaders(false); conf.setFileName(false); conf.setIdleTime(false); conf.setSuccess(true); conf.setMessage(true); conf.setEncoding(false); conf.setThreadCounts(true); conf.setFieldNames(true); conf.setAssertions(false); conf.setResponseData(false); conf.setSubresults(false); conf.setLatency(true); conf.setLabel(true); conf.setThreadName(true); conf.setBytes(true); conf.setHostname(true); conf.setAssertionResultsFailureMessage(false); conf.setResponseHeaders(false); conf.setUrl(false); conf.setTime(true); conf.setTimestamp(true); conf.setCode(true); conf.setDataType(false); conf.setSampleCount(false); }
/** * Constructor which sets the used {@link Summariser} * @param summer The {@link Summariser} to use */ public ResultCollector(Summariser summer) { setErrorLogging(false); setSuccessOnlyLogging(false); setProperty(new ObjectProperty(SAVE_CONFIG, new SampleSaveConfiguration())); summariser = summer; }
/** {@inheritDoc} */ @Override public void marshal(Object obj, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(obj, writer, context); // Save most things SampleSaveConfiguration prop = (SampleSaveConfiguration) obj; // Save the new fields - but only if they are true // This list MUST agree with the list in MyWrapper#shouldSerializeMember() createNode(writer,prop.saveBytes(),NODE_BYTES); createNode(writer,prop.saveSentBytes(),NODE_SENT_BYTES); createNode(writer,prop.saveUrl(),NODE_URL); createNode(writer,prop.saveFileName(),NODE_FILENAME); createNode(writer,prop.saveHostname(),NODE_HOSTNAME); createNode(writer,prop.saveThreadCounts(),NODE_THREAD_COUNT); createNode(writer,prop.saveSampleCount(),NODE_SAMPLE_COUNT); createNode(writer,prop.saveIdleTime(),NODE_IDLE_TIME); createNode(writer, prop.saveConnectTime(), NODE_CONNECT_TIME); }
rc.setErrorLogging(false); rc.isSampleWanted(true); SampleSaveConfiguration ssc = new SampleSaveConfiguration(); ssc.setTime(false); ssc.setLatency(false); ssc.setTimestamp(true); ssc.setSuccess(true); ssc.setLabel(false); ssc.setCode(false); ssc.setMessage(false); ssc.setThreadName(false); ssc.setDataType(false); ssc.setEncoding(false); ssc.setAssertions(false); ssc.setSubresults(false); ssc.setResponseData(false); ssc.setSamplerData(false); ssc.setAsXml(false); ssc.setFieldNames(false); ssc.setResponseHeaders(false); ssc.setRequestHeaders(false); ssc.setAssertionResultsFailureMessage(false); ssc.setThreadCounts(false); rc.setSaveConfig(ssc); rc.setFilename("C:\\Users\\Andrew2\\Desktop\\constantthroughput-singleserver.csv");
if (saveConfig.saveTimestamp()) { configuredColumns.add(CSVSaveService.TIME_STAMP); if (saveConfig.saveTime()) { configuredColumns.add(CSVSaveService.CSV_ELAPSED); if (saveConfig.saveLabel()) { configuredColumns.add(CSVSaveService.LABEL); if (saveConfig.saveCode()) { configuredColumns.add(CSVSaveService.RESPONSE_CODE); if (saveConfig.saveMessage()) { configuredColumns.add(CSVSaveService.RESPONSE_MESSAGE); if (saveConfig.saveThreadName()) { configuredColumns.add(CSVSaveService.THREAD_NAME); if (saveConfig.saveDataType()) { configuredColumns.add(CSVSaveService.DATA_TYPE); if (saveConfig.saveSuccess()) { configuredColumns.add(CSVSaveService.SUCCESSFUL); if (saveConfig.saveAssertionResultsFailureMessage()) { configuredColumns.add(CSVSaveService.FAILURE_MESSAGE); if (saveConfig.saveBytes()) { configuredColumns.add(CSVSaveService.CSV_BYTES);
@Override public void testStarted(String host) { if (!isWorkingHost(host)) { return; } //ensure the data will be saved if (getProperty(FILENAME) == null || getProperty(FILENAME).getStringValue().trim().length() == 0) { if (autoGenerateFiles) { setupSaving(getAutoFileName()); } else { try { File tmpFile = File.createTempFile("perfmon_", ".jtl"); tmpFile.delete(); // required to have CSV header setupSaving(tmpFile.getAbsolutePath()); } catch (IOException ex) { log.info("PerfMon metrics will not be recorded! Please run the test with -JforcePerfmonFile=true", ex); } } } log.debug("PerfMon metrics will be stored in " + getPropertyAsString(FILENAME)); if (!getSaveConfig().saveAsXml() && getSaveConfig().saveFieldNames()) { filesList.add(getPropertyAsString(FILENAME)); } else { log.warn("Perfmon file saving setting is not CSV with header line, cannot upload it to BM.Sense: " + getPropertyAsString(FILENAME)); } initiateConnectors(); workerThread = new Thread(this); workerThread.start(); super.testStarted(host); }
private static void writeFileEnd(PrintWriter pw, SampleSaveConfiguration saveConfig) { if (saveConfig.saveAsXml()) { pw.print("\n"); // $NON-NLS-1$ pw.print(TESTRESULTS_END); pw.print("\n");// Added in version 1.1 // $NON-NLS-1$ } }
public FlushingResultCollector() { super(); getSaveConfig().setFieldNames(true); }
String[] parts = splitHeader(headerLine, _saveConfig.getDelimiter()); // Try SampleSaveConfiguration saveConfig = new SampleSaveConfiguration(false); if (log.isWarnEnabled()) { log.warn("Default delimiter '{}' did not work; using alternate '{}' for reading {}", _saveConfig.getDelimiter(), delim, filename); saveConfig.setDelimiter(delim); saveConfig.setVarCount(varCount);
/** * Save the data of the sample result to a stream * * @param writer * stream to save objects into * @param context * context for xstream to allow nested objects * @param res * sample to be saved * @param save * configuration telling us what to save */ protected void saveSamplerData(HierarchicalStreamWriter writer, MarshallingContext context, SampleResult res, SampleSaveConfiguration save) { if (save.saveSamplerData(res)) { writeString(writer, TAG_SAMPLER_DATA, res.getSamplerData()); } if (save.saveUrl()) { final URL url = res.getURL(); if (url != null) { writeItem(url, context, writer); } } }
SampleSaveConfiguration saveConfig) { StringBuilder text = new StringBuilder(); String delim = saveConfig.getDelimiter(); appendFields(saveConfig.saveTimestamp(), text, delim, TIME_STAMP); appendFields(saveConfig.saveTime(), text, delim, CSV_ELAPSED); appendFields(saveConfig.saveLabel(), text, delim, LABEL); appendFields(saveConfig.saveCode(), text, delim, RESPONSE_CODE); appendFields(saveConfig.saveMessage(), text, delim, RESPONSE_MESSAGE); appendFields(saveConfig.saveThreadName(), text, delim, THREAD_NAME); appendFields(saveConfig.saveDataType(), text, delim, DATA_TYPE); appendFields(saveConfig.saveSuccess(), text, delim, SUCCESSFUL); appendFields(saveConfig.saveAssertionResultsFailureMessage(), text, delim, FAILURE_MESSAGE); appendFields(saveConfig.saveBytes(), text, delim, CSV_BYTES); appendFields(saveConfig.saveSentBytes(), text, delim, CSV_SENT_BYTES); appendFields(saveConfig.saveThreadCounts(), text, delim, CSV_THREAD_COUNT1, CSV_THREAD_COUNT2); appendFields(saveConfig.saveUrl(), text, delim, CSV_URL); appendFields(saveConfig.saveFileName(), text, delim, CSV_FILENAME); appendFields(saveConfig.saveLatency(), text, delim, CSV_LATENCY); appendFields(saveConfig.saveEncoding(), text, delim, CSV_ENCODING); appendFields(saveConfig.saveSampleCount(), text, delim, CSV_SAMPLE_COUNT, CSV_ERROR_COUNT); appendFields(saveConfig.saveHostname(), text, delim, CSV_HOSTNAME); appendFields(saveConfig.saveIdleTime(), text, delim, CSV_IDLETIME); appendFields(saveConfig.saveConnectTime(), text, delim, CSV_CONNECT_TIME);
@Override public void testStarted(String host) { if (!isWorkingHost(host)) { return; } //ensure the data will be saved if (getProperty(FILENAME) == null || getProperty(FILENAME).getStringValue().trim().length() == 0) { if (autoGenerateFiles) { setupSaving(getAutoFileName()); } else { try { File tmpFile = File.createTempFile("perfmon_", ".jtl"); tmpFile.delete(); // required to have CSV header setupSaving(tmpFile.getAbsolutePath()); } catch (IOException ex) { log.info("PerfMon metrics will not be recorded! Please run the test with -JforcePerfmonFile=true", ex); } } } log.debug("PerfMon metrics will be stored in " + getPropertyAsString(FILENAME)); if (!getSaveConfig().saveAsXml() && getSaveConfig().saveFieldNames()) { filesList.add(getPropertyAsString(FILENAME)); } else { log.warn("Perfmon file saving setting is not CSV with header line: " + getPropertyAsString(FILENAME)); } initiateConnectors(); workerThread = new Thread(this); workerThread.start(); super.testStarted(host); }
private static void writeFileEnd(PrintWriter pw, SampleSaveConfiguration saveConfig) { if (saveConfig.saveAsXml()) { pw.print("\n"); pw.print(TESTRESULTS_END); pw.print("\n");// Added in version 1.1 } }
public FlushingResultCollector() { super(); getSaveConfig().setFieldNames(true); }
private void saveSamplerData(HierarchicalStreamWriter writer, MarshallingContext context, HTTPSampleResult res, SampleSaveConfiguration save) { if (save.saveSamplerData(res)) { writeString(writer, TAG_COOKIES, res.getCookies()); writeString(writer, TAG_METHOD, res.getHTTPMethod()); writeString(writer, TAG_QUERY_STRING, res.getQueryString()); writeString(writer, TAG_REDIRECT_LOCATION, res.getRedirectLocation()); } if (save.saveUrl()) { writeItem(res.getURL(), context, writer); } }
public static void doBestCSVSetup(SampleSaveConfiguration conf) { conf.setAsXml(false); conf.setFieldNames(true); conf.setSamplerData(false); conf.setRequestHeaders(false); conf.setFileName(false); conf.setIdleTime(false); conf.setSuccess(true); conf.setMessage(true); conf.setEncoding(false); conf.setThreadCounts(true); conf.setFieldNames(true); conf.setAssertions(false); conf.setResponseData(false); conf.setSubresults(false); conf.setLatency(true); conf.setLabel(true); conf.setThreadName(true); conf.setBytes(true); conf.setHostname(true); conf.setAssertionResultsFailureMessage(false); conf.setResponseHeaders(false); conf.setUrl(false); conf.setTime(true); conf.setTimestamp(true); conf.setCode(true); conf.setDataType(false); conf.setSampleCount(false); }
if (saveConfig.saveTimestamp()) { field = TIME_STAMP; text = parts[i++]; if (saveConfig.printMilliseconds()) { try { timeStamp = stamp.getTime(); log.warn("Setting date format to: {}", fmt); saveConfig.setDateFormat(fmt); foundMatch = true; break; } else if (saveConfig.strictDateFormatter() != null) { Date stamp = saveConfig.strictDateFormatter().parse(text); timeStamp = stamp.getTime(); } else { // can this happen? if (saveConfig.saveTime()) { field = CSV_ELAPSED; text = parts[i++]; if (saveConfig.saveSampleCount()) { result = new StatisticalSampleResult(timeStamp, elapsed); } else { if (saveConfig.saveLabel()) { field = LABEL; text = parts[i++]; result.setSampleLabel(text);