<commit_before>package org.csstudio.utility.pv.epics;

import gov.aps.jca.Channel;
import gov.aps.jca.Context;
import gov.aps.jca.JCALibrary;
import gov.aps.jca.Monitor;
import gov.aps.jca.dbr.DBRType;
import gov.aps.jca.dbr.DBR_TIME_Double;
import gov.aps.jca.event.MonitorEvent;
import gov.aps.jca.event.MonitorListener;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/** JCA Tests
 *  <p>
 *  Must set LD_LIBRARY_PATH to locate JCA lib,
 *  since this is running outside of a plugin.
 *
 *  @author <NAME>
 */
@SuppressWarnings("nls")
public class JCATests
{
    private static final String PV_NAME = "RFQ_Vac:Pump3:Pressure";
    private static final String ADDR_LIST = "192.168.127.12";
    
    // Small number of test runs allows to check for "12 blocks" in valgrind output
    // to locate blocks lost in every run of the loop.
    // Bit number allows longer test.
    private static final int TESTRUNS = 12;

    /** Set <code>true</code> to check for cleanup error. */
    private static final boolean CLEANUP = false;
    private static JCALibrary jca = null;
    private static Context jca_context = null;
    
    final private static DateFormat format =
        new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
    
    private static int values = 0;
    
    /** Monitor given PV for some time. */
    static private void run(final String pv_name) throws Exception
    {
        // Lib init
        if (jca == null)
            jca = JCALibrary.getInstance();
        if (jca_context == null)
            jca_context= jca.createContext(JCALibrary.JNI_THREAD_SAFE);
                
        // Connect
        final Channel channel = jca_context.createChannel(pv_name);

        // Subscribe
        MonitorListener monitor = new MonitorListener()
        {
            public void monitorChanged(MonitorEvent event)
            {
            	++values;<commit_msg>cmd line examples<commit_after>package org.csstudio.utility.pv.epics;

import gov.aps.jca.Channel;
import gov.aps.jca.Context;
import gov.aps.jca.JCALibrary;
import gov.aps.jca.Monitor;
import gov.aps.jca.dbr.DBRType;
import gov.aps.jca.dbr.DBR_TIME_Double;
import gov.aps.jca.event.MonitorEvent;
import gov.aps.jca.event.MonitorListener;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/** JCA Tests
 *  <p>
 *  Must set LD_LIBRARY_PATH to locate JCA lib,
 *  since this is running outside of a plugin.
 *  <p>
 *  Can be run from the command line within the plugin directory
 *  like this:
 *  
 *  OS X:
 *  DYLD_LIBRARY_PATH=../org.csstudio.platform.libs.epics/lib/macosx/x86 \
 *  java -classpath ../org.csstudio.platform.libs.epics/lib/jca-2.3.2.jar:bin \
 *   org.csstudio.utility.pv.epics.JCATests
 *
 *  Linux:
 *  LD_LIBRARY_PATH=../org.csstudio.platform.libs.epics/lib/linux/x86 \
 *  java -classpath ../org.csstudio.platform.libs.epics/lib/jca-2.3.2.jar:bin \
 *   org.csstudio.utility.pv.epics.JCATests
 * 
 *  @author <NAME>
 */
@SuppressWarnings("nls")
public class JCATests
{
    private static final String PV_NAME = "RFQ_Vac:Pump3:Pressure";
    private static final String ADDR_LIST = "192.168.127.12";
    
    // Small number of test runs allows to check for "12 blocks" in valgrind output
    // to locate blocks lost in every run of the loop.
    // Bit number allows longer test.
    private static final int TESTRUNS = 50000;

    /** Set <code>true</code> to check for cleanup error. */
    private static final boolean CLEANUP = false;
    private static JCALibrary jca = null;
    private static Context jca_context = null;
    
    final private static DateFormat format =
        new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
    
    private static int values = 0;
    
    /** Monitor given PV for some time. */
    static private void run(final String pv_name) throws Exception
    {
        // Lib init
        if (jca == null)
            jca = JCALibrary.getInstance();
        if (jca_context == null)
            jca_context= jca.createContext(JCALibrary.JNI_THREAD_SAFE);
                
        // Connect
        final Channel channel = jca_context.createChannel(pv_name);

        // Subscribe
        MonitorListener monitor = new MonitorListener()
        {
            public void monitorChanged(MonitorEvent event)
            {
            	++values;
{'fraction_non_alphanumeric': 0.10174152153987168, 'fraction_numerical': 0.01076993583868011, 'mean_word_length': 2.6928934010152283, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '424859', 'n_tokens_mistral': 1466, 'n_tokens_neox': 1411, 'n_words': 372}