ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/juli/TesterOneLineFormatterMillisPerformance.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/juli/TesterOneLineFormatterMillisPerformance.java
Status
scanned
Type
file
Name
TesterOneLineFormatterMillisPerformance.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
3015 (2.9 KB)
MD5
3f2a870065020faf045905d4094f246f
SHA1
3513e588935832261f286b404eec92d61cc4193f
SHA256
e28d06cae370aa6a4ba48bd29dc6a96080ec82dab0ab613d71521443f1a2caa9
SHA512

      
    
SHA1_git
09b0e8bf51409f073e6d93e12d0959a21000071d
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TesterOneLineFormatterMillisPerformance.java | 2.9 KB |

/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.juli; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; /* * This is an absolute performance test. There is no benefit it running it as part of a standard test run so it is * excluded due to the name starting Tester... */ @RunWith(Parameterized.class) public class TesterOneLineFormatterMillisPerformance { @Parameterized.Parameters(name = "{index}: format[{0}]") public static Collection<Object[]> parameters() { List<Object[]> parameterSets = new ArrayList<>(); parameterSets.add(new String[] { "dd-MMM-yyyy HH:mm:ss.SSS" }); parameterSets.add(new String[] { "dd-MMM-yyyy HH:mm:ss.SS" }); parameterSets.add(new String[] { "dd-MMM-yyyy HH:mm:ss.S" }); parameterSets.add(new String[] { "dd-MMM-yyyy HH:mm:ss" }); parameterSets.add(new String[] { "dd-MMM-yyyy HH:mm:ss XXX" }); parameterSets.add(new String[] { "dd-MMM-yyyy HH:mm:ss.SSSXXX" }); parameterSets.add(new String[] { "dd-MMM-yyyy HH:mm:ss.SSXXX" }); parameterSets.add(new String[] { "dd-MMM-yyyy HH:mm:ss.SXXX" }); parameterSets.add(new String[] { "SSS dd-MMM-yyyy HH:mm:ss" }); parameterSets.add(new String[] { "SS dd-MMM-yyyy HH:mm:ss" }); parameterSets.add(new String[] { "S dd-MMM-yyyy HH:mm:ss" }); return parameterSets; } @Parameter(0) public String timestampFormat; @Test public void testMillisHandling() { OneLineFormatter olf = new OneLineFormatter(); olf.setTimeFormat(timestampFormat); long timeStamp = System.currentTimeMillis(); StringBuilder buf = new StringBuilder(64); long start = System.nanoTime(); for (int i = 0; i < 10000000; i++) { buf.setLength(0); olf.addTimestamp(buf, timeStamp); } System.out.println("Format: [" + timestampFormat + "], Output: [" + buf + "], Duration: [" + (System.nanoTime() - start) + "] ns"); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
31.23
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9