<commit_before># Dumpling

Dumpling is an object model and domain specific language to represent and query the state of
process threads and their lock based dependencies.

Dumpling is shipped with a collection of predefined queries to cover most common
situations as well as several factories to create thread model from various sources.

## Usage

### Bundle dumpling to your application

Make dumpling part of your application and inspect threads from within.

- Include following maven dependency
```xml
    <dependency>
      <groupId>com.github.olivergondza.dumpling</groupId>
      <artifactId>dumpling</artifactId>
      <version>...</version>
    </dependency>
```

- Instantiate runtime of current JVM
```java
    // JvmRuntimeFactory creates model from host JVM
    ProcessRuntime runtime = new JvmRuntimeFactory().currentRuntime();
```

- Get the work done

### Invoking dumpling from console

Use dumpling to discover problems in thread dumps.

- Build self-contained `dumpling.jar`
```bash
    git clone https://github.com/olivergondza/dumpling.git
    cd dumpling
    mvn package
    cd ..
    mv dumpling/target/dumpling.jar .
```

- Invoke queries as needed
```bash
    java -jar dumpling.jar help
    java -jar dumpling.jar help <command>

    # Run build-in query (detect-deadlocks)
    java -jar dumpling.jar detect-deadlocks --in threaddump jstack-crash.log

    # Run custom groovy query
    java -jar dumpling.jar groovy --in threaddump jstack-crash.log <<< "print runtime.threads.grep { it.threadStatus == ThreadStatus.RUNNABLE }"
```

- Profit

[Dumpling DSL tutorial](DOCS/INTRO.md)

## Modules

### model

Immutable domain objects. 

### query<commit_msg>Document groovysh<commit_after># Dumpling

Dumpling is an object model and domain specific language to represent and query the state of
process threads and their lock based dependencies.

Dumpling is shipped with a collection of predefined queries to cover most common
situations as well as several factories to create thread model from various sources.

## Usage

### Bundle dumpling to your application

Make dumpling part of your application and inspect threads from within.

- Include following maven dependency
```xml
    <dependency>
      <groupId>com.github.olivergondza.dumpling</groupId>
      <artifactId>dumpling</artifactId>
      <version>...</version>
    </dependency>
```

- Instantiate runtime of current JVM
```java
    // JvmRuntimeFactory creates model from host JVM
    ProcessRuntime runtime = new JvmRuntimeFactory().currentRuntime();
```

- Get the work done

### Invoking dumpling from console

Use dumpling to discover problems in thread dumps.

- Build self-contained `dumpling.jar`
```bash
    $ git clone https://github.com/olivergondza/dumpling.git
    $ cd dumpling
    $ mvn package
    $ cd ..
    $ mv dumpling/target/dumpling.jar .
```

- Invoke queries as needed
```bash
    $ java -jar dumpling.jar help
    $ java -jar dumpling.jar help <command>

    # Run build-in query (detect-deadlocks)
    $ java -jar dumpling.jar detect-deadlocks --in threaddump jstack-crash.log

    # Run custom groovy query
    $ java -jar dumpling.jar groovy --in threaddump jstack-crash.log <<< "print runtime.threads.grep { it.threadStatus == ThreadStatus.RUNNABLE }"

    # Run interactive shell for investigation
    $ java -jar dumpling.jar groovysh
    groovy:000> rt = load("oraclejdk-1.7.0_51.log")
    ===> com.github.olivergondza.dumpling.model.ProcessRuntime@10745d92
    groovy:000> rt.threads.grep { it.threadStatus == ThreadStatus.RUNNABLE }
```

- Profit

[Dumpling DSL tutorial](DOCS/INTRO.md)

## Modules

### model

Immutable domain objects. 

### query
{'fraction_non_alphanumeric': 0.09427792915531336, 'fraction_numerical': 0.004904632152588556, 'mean_word_length': 3.629255989911728, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 24, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '842222', 'n_tokens_mistral': 1168, 'n_tokens_neox': 1064, 'n_words': 365}