Atlantiraptor Docs

Generic.Client.Profile

Type: Client

Collects runtime profiling data including goroutines, memory, CPU, and metrics from the client.

This is useful when you notice a high CPU load in the client and want to understand why that’s happening.

The following options are most useful:

  1. Goroutines: This shows the backtraces of all currently running goroutines. It will generally show most of the code working in the current running set of queries.

  2. Heap: This shows all allocations currently in use and where they are allocated from. This is useful if the client is taking too much memory.

  3. Profile: This takes a CPU profile of the running process for the number of seconds specified in the Duration parameter. You can read profiles by using:

    go tool pprof -callgrind -output=profile.grind profile.bin
    kcachegrind profile.grind
    

Note that this really only makes sense when another query is running at the same time since this artifacts itself will not be doing very much other than just measuring the state of the process.

NOTE: As of 0.7.0 release, this artifact will also collect goroutines and heap profiles as distinct sources in a more readable way.

Parameters

Name Type Default Description
Allocs bool Y A sampling of all past memory allocations
Block bool Stack traces that led to blocking on synchronization primitives
Goroutine bool Y Stack traces of all current goroutines
Heap bool A sampling of memory allocations of live objects
Mutex bool Stack traces of holders of contended mutexes
Profile bool CPU profile
Trace bool CPU trace
Logs bool Get logs
QueryLogs bool Get recent queries logs
Metrics bool Get client metrics
Verbose bool Print more detail
Duration string 30 Duration of sampling for Profile and Trace.

Source

Defined in artifacts/definitions/Generic/Client/Profile.yaml.

name: Generic.Client.Profile
description: |
  Collects runtime profiling data including goroutines, memory, CPU,
  and metrics from the client.

  This is useful when you notice a high CPU load in the client and
  want to understand why that's happening.

  The following options are most useful:

  1. Goroutines: This shows the backtraces of all currently running
     goroutines. It will generally show most of the code working in the
     current running set of queries.

  2. Heap: This shows all allocations currently in use and where they
     are allocated from. This is useful if the client is taking too
     much memory.

  3. Profile: This takes a CPU profile of the running process for the
     number of seconds specified in the Duration parameter. You can
     read profiles by using:

  ` ` `
  go tool pprof -callgrind -output=profile.grind profile.bin
  kcachegrind profile.grind
  ` ` `

  Note that this really only makes sense when another query is running
  at the same time since this artifacts itself will not be doing very
  much other than just measuring the state of the process.

  NOTE: As of 0.7.0 release, this artifact will also collect
  goroutines and heap profiles as distinct sources in a more readable
  way.

parameters:
  - name: Allocs
    description: A sampling of all past memory allocations
    type: bool
    default: Y
  - name: Block
    description: Stack traces that led to blocking on synchronization primitives
    type: bool
  - name: Goroutine
    description: Stack traces of all current goroutines
    type: bool
    default: Y
  - name: Heap
    description: A sampling of memory allocations of live objects
    type: bool
  - name: Mutex
    description: Stack traces of holders of contended mutexes
    type: bool
  - name: Profile
    description: CPU profile
    type: bool
  - name: Trace
    description: CPU trace
    type: bool
  - name: Logs
    description: Get logs
    type: bool
  - name: QueryLogs
    description: Get recent queries logs
    type: bool
  - name: Metrics
    description: Get client metrics
    type: bool
  - name: Verbose
    description: Print more detail
    type: bool
  - name: Duration
    description: Duration of sampling for Profile and Trace.
    default: "30"

export: |
    LET CleanUp(Name) = regex_replace(
        re="www.velocidex.com/golang/velociraptor/",
        replace="", source=Name)

sources:
  - query: |
      LET X = scope()

      SELECT *, X.OSPath && X.Type && upload(name=X.Type + ".bin", file=X.OSPath) AS File
      FROM profile(allocs=Allocs, block=Block, goroutine=Goroutine,
                   heap=Heap, mutex=Mutex, profile=Profile, trace=Trace,
                   logs=Logs, queries=QueryLogs, metrics=Metrics,
                   debug=if(condition=Verbose, then=2, else=1),
                   duration=atoi(string=Duration))

  - name: Goroutines
    query: |
      -- Only show our own code. This removed unnecessary library
      -- calls and cleans up the output.
      SELECT *, {
         SELECT format(format="%v (%v:%v)",
             args=[CleanUp(Name=Name), basename(path=File), Line])
         FROM CallStack
         WHERE File =~ 'velociraptor|vfilter|go-ntfs'
         LIMIT 10
      } AS CallStack
      FROM profile_goroutines()
      WHERE CallStack

  - name: Memory
    query: |
      SELECT InUseBytes, InUseObjects, {
          SELECT format(format="%v (%v:%v)",
            args=[CleanUp(Name=Name), basename(path=File), Line])
          FROM CallStack
          WHERE File =~ 'velociraptor|vfilter|go-ntfs'
          LIMIT 10
      } AS CallStack
      FROM profile_memory()
      ORDER BY InUseBytes DESC

  - name: Logs
    query: |
      SELECT * FROM profile(logs=TRUE)

  - name: RunningQueries
    query: |
      SELECT Line.Start AS Timestamp, Line.Query AS Query
      FROM profile(queries=TRUE)
      WHERE NOT Line.Duration

  - name: AllQueries
    query: |
      SELECT Line.Start AS Timestamp, int(int = Line.Duration / 1000000) AS DurationSec, Line.Query AS Query
      FROM profile(queries=TRUE)

  - name: Metrics
    query: |
      SELECT *
      FROM profile(metrics=TRUE)

  - name: Everything
    query: SELECT * FROM profile(type='.+')

column_types:
  - name: InUseBytes
    type: mb

Edit this page on GitHub

© 2026 Atlant Security EOOD. Atlantiraptor is free software under the GNU Affero General Public License v3. It is based on Velociraptor by Velocidex, and keeps its copyright notices. Velociraptor is a trademark of its owner; Atlantiraptor is not affiliated with or endorsed by it.