forked from KindlingProject/kindling
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from KindlingProject/main
Rocketmq Protocol Identification and Analysis (KindlingProject#328)
- Loading branch information
Showing
52 changed files
with
3,089 additions
and
1,736 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: KINDLING-CI | ||
name: Kindling-agent-CI | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Kindling-front-CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-latest-test: | ||
if: github.repository == 'CloudDectective-Harmonycloud/kindling' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Set TAG | ||
run: echo "TAG=latesttest" >> $GITHUB_ENV | ||
- uses: actions/checkout@v3 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME}} | ||
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ${{ github.workspace }}/camera-front | ||
file: ${{ github.workspace }}/camera-front/Dockerfile | ||
push: true | ||
tags: kindlingproject/kindling-camera-front:${{ env.TAG }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
collector/pkg/component/analyzer/cpuanalyzer/delete_tid.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package cpuanalyzer | ||
|
||
import ( | ||
"sync" | ||
"time" | ||
) | ||
|
||
type tidDeleteQueue struct { | ||
queueMutex sync.Mutex | ||
queue []deleteTid | ||
} | ||
|
||
type deleteTid struct { | ||
pid uint32 | ||
tid uint32 | ||
exitTime time.Time | ||
} | ||
|
||
func newTidDeleteQueue() *tidDeleteQueue { | ||
return &tidDeleteQueue{queue: make([]deleteTid, 0)} | ||
} | ||
|
||
func (dq *tidDeleteQueue) GetFront() *deleteTid { | ||
if len(dq.queue) > 0 { | ||
return &dq.queue[0] | ||
} | ||
return nil | ||
} | ||
|
||
func (dq *tidDeleteQueue) Push(elem deleteTid) { | ||
dq.queue = append(dq.queue, elem) | ||
} | ||
|
||
func (dq *tidDeleteQueue) Pop() { | ||
if len(dq.queue) > 0 { | ||
dq.queue = dq.queue[1:len(dq.queue)] | ||
} | ||
} | ||
|
||
func (ca *CpuAnalyzer) TidDelete(interval time.Duration, expiredDuration time.Duration) { | ||
for { | ||
select { | ||
case <-time.After(interval): | ||
now := time.Now() | ||
func() { | ||
ca.tidExpiredQueue.queueMutex.Lock() | ||
defer ca.tidExpiredQueue.queueMutex.Unlock() | ||
for { | ||
elem := ca.tidExpiredQueue.GetFront() | ||
if elem == nil { | ||
break | ||
} | ||
if elem.exitTime.Add(expiredDuration).After(now) { | ||
break | ||
} | ||
//Delete expired threads (current_time >= thread_exit_time + interval_time). | ||
func() { | ||
ca.lock.Lock() | ||
defer ca.lock.Unlock() | ||
tidEventsMap := ca.cpuPidEvents[elem.pid] | ||
if tidEventsMap == nil { | ||
ca.tidExpiredQueue.Pop() | ||
} else { | ||
ca.telemetry.Logger.Debugf("Delete expired thread... pid=%d, tid=%d", elem.pid, elem.tid) | ||
//fmt.Printf("Go Test: Delete expired thread... pid=%d, tid=%d\n", elem.pid, elem.tid) | ||
delete(tidEventsMap, elem.tid) | ||
ca.tidExpiredQueue.Pop() | ||
} | ||
}() | ||
} | ||
}() | ||
} | ||
} | ||
} |
Oops, something went wrong.