<commit_before>/*
 * Copyright 2009-2013 by The Regents of the University of California
 * Licensed 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 from
 * 
 *     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 edu.uci.ics.asterix.transaction.management.service.locking;

import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;

final class LockManagerStats {
    private final int loggingPeriod;
    
    private final AtomicInteger lCnt = new AtomicInteger();
    private final AtomicInteger ilCnt = new AtomicInteger();
    private final AtomicInteger tlCnt = new AtomicInteger();
    private final AtomicInteger itlCnt = new AtomicInteger();
    private final AtomicInteger ulCnt = new AtomicInteger();
    private final AtomicInteger rlCnt = new AtomicInteger();

    LockManagerStats(int loggingPeriod) {
        this.loggingPeriod = loggingPeriod;
    }
    
    final void lock()           { lCnt.incrementAndGet(); }
    final void instantLock()    { ilCnt.incrementAndGet(); }
    final void tryLock()        { tlCnt.incrementAndGet(); }
    final void instantTryLock() { itlCnt.incrementAndGet(); }
    final void unlock()         { ulCnt.incrementAndGet(); }
    final void releaseLocks()   { rlCnt.incrementAndGet(); }
    
    final int requestSum() {
        return lCnt.intValue() + ilCnt.intValue() + tlCnt.intValue() 
                + itlCnt.intValue() + ulCnt.intValue() + rlCnt.intValue();
    }

    final StringBuilder append(StringBuilder sb) {
        sb.append("{")
        .append(" lock : ").append(lCnt)<commit_msg>32 bits are not enough for LockManagerStats<commit_after>/*
 * Copyright 2009-2013 by The Regents of the University of California
 * Licensed 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 from
 * 
 *     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 edu.uci.ics.asterix.transaction.management.service.locking;

import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Level;
import java.util.logging.Logger;

final class LockManagerStats {
    private final int loggingPeriod;
    
    private final AtomicLong lCnt = new AtomicLong();
    private final AtomicLong ilCnt = new AtomicLong();
    private final AtomicLong tlCnt = new AtomicLong();
    private final AtomicLong itlCnt = new AtomicLong();
    private final AtomicLong ulCnt = new AtomicLong();
    private final AtomicLong rlCnt = new AtomicLong();

    LockManagerStats(int loggingPeriod) {
        this.loggingPeriod = loggingPeriod;
    }
    
    final void lock()           { lCnt.incrementAndGet(); }
    final void instantLock()    { ilCnt.incrementAndGet(); }
    final void tryLock()        { tlCnt.incrementAndGet(); }
    final void instantTryLock() { itlCnt.incrementAndGet(); }
    final void unlock()         { ulCnt.incrementAndGet(); }
    final void releaseLocks()   { rlCnt.incrementAndGet(); }
    
    final int requestSum() {
        return lCnt.intValue() + ilCnt.intValue() + tlCnt.intValue() 
                + itlCnt.intValue() + ulCnt.intValue() + rlCnt.intValue();
    }

    final StringBuilder append(StringBuilder sb) {
        sb.append("{")
        .append(" lock : ").append(lCnt)
{'fraction_non_alphanumeric': 0.09377289377289377, 'fraction_numerical': 0.006349206349206349, 'mean_word_length': 3.352816153028693, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1225936', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1129, 'n_words': 377}