-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for coverage of RUST and GO binaries
- Loading branch information
Showing
11 changed files
with
518 additions
and
8 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
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,153 @@ | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: coverage-ingress | ||
spec: | ||
rules: | ||
- host: master.platform.science-hangar.eu | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: master | ||
port: | ||
number: 80 | ||
|
||
- host: worker0.platform.science-hangar.eu | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: workers-0 | ||
port: | ||
number: 80 | ||
|
||
- host: worker1.platform.science-hangar.eu | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: worker1 | ||
port: | ||
number: 80 | ||
|
||
--- | ||
apiVersion: frisbee.io/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
name: tikv-baseline | ||
spec: | ||
withTelemetry: | ||
importMonitors: [ "platform.telemetry.container", "ycsb.telemetry.client", "tikv.telemetry.pd", "tikv.telemetry.worker" ] | ||
|
||
actions: | ||
# Step 0: bootstrap. | ||
# For TiKV, we must first create a placementDriver and then add the workers. | ||
- action: Service | ||
name: master | ||
service: | ||
fromTemplate: | ||
templateRef: tikv.cluster.coverage.placement-driver | ||
#inputs: | ||
# - { cpu: "4", memory: "8Gi" } | ||
|
||
- action: Cluster | ||
depends: { running: [ master ] } | ||
name: workers | ||
cluster: | ||
templateRef: tikv.cluster.coverage.worker | ||
instances: 1 | ||
inputs: | ||
- { placementDriver: .service.master.any } | ||
|
||
# Step 1: Load a new dataset, using the parameters of workload A. | ||
# We use no throttling to maximize this step and complete it soon. | ||
- action: Service | ||
depends: { running: [ workers ] , after: 30h} | ||
name: loader | ||
service: | ||
fromTemplate: | ||
templateRef: ycsb.tikv.loader | ||
inputs: | ||
- { server: .service.master.any, workload: workloada, recordcount: "10000000" } | ||
|
||
# Step 2: Run workload A | ||
- action: Service | ||
depends: { success: [ loader ] } | ||
name: workload-a | ||
service: | ||
fromTemplate: | ||
templateRef: ycsb.tikv.runner | ||
inputs: | ||
- { server: .service.master.any, workload: workloada, operationcount: "1000000", } | ||
|
||
# Step 3: Run workload B | ||
- action: Service | ||
depends: { success: [ workload-a ] } | ||
name: workload-b | ||
service: | ||
fromTemplate: | ||
templateRef: ycsb.tikv.runner | ||
inputs: | ||
- { server: .service.master.any, workload: workloadb, operationcount: "1000000",} | ||
|
||
# Step 4: Run workload C | ||
- action: Service | ||
depends: { success: [ workload-b ] } | ||
name: workload-c | ||
service: | ||
fromTemplate: | ||
templateRef: ycsb.tikv.runner | ||
inputs: | ||
- { server: .service.master.any, workload: workloadc, operationcount: "1000000",} | ||
|
||
|
||
# Step 5: Run workload F | ||
- action: Service | ||
depends: { success: [ workload-c ] } | ||
name: workload-f | ||
service: | ||
fromTemplate: | ||
templateRef: ycsb.tikv.runner | ||
inputs: | ||
- { server: .service.master.any, workload: workloadf, operationcount: "1000000",} | ||
|
||
|
||
# Step 6: Run workload D. | ||
- action: Service | ||
depends: { success: [ workload-f ] } | ||
name: workload-d | ||
service: | ||
fromTemplate: | ||
templateRef: ycsb.tikv.runner | ||
inputs: | ||
- { server: .service.master.any, workload: workloadd, operationcount: "1000000",} | ||
|
||
|
||
# Step 7,8: Reload the data with parameters of workload E. | ||
# We use the dropdata field to remove all data before test. | ||
- action: Service | ||
depends: { success: [ workload-d ] } | ||
name: reloader | ||
service: | ||
fromTemplate: | ||
templateRef: ycsb.tikv.loader | ||
inputs: | ||
- { server: .service.master.any, workload: workloade, dropdata: "true", recordcount: "1000000",} | ||
|
||
# Step 9:Run workload E | ||
- action: Service | ||
depends: { success: [ reloader ] } | ||
name: workload-e | ||
service: | ||
fromTemplate: | ||
templateRef: ycsb.tikv.runner | ||
inputs: | ||
- { server: .service.master.any, workload: workloade, operationcount: "1000000",} |
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,161 @@ | ||
--- | ||
# In some situations such as in the Docker or NAT network environment, if the other nodes (peers) cannot access | ||
# the PD node through the default peer URLs listened to by this PD node, you must manually set the advertise peer URLs. | ||
apiVersion: frisbee.io/v1alpha1 | ||
kind: Template | ||
metadata: | ||
name: tikv.cluster.coverage.placement-driver | ||
labels: | ||
app.kubernetes.io/managed-by: {{.Release.Service | quote}} | ||
spec: | ||
inputs: | ||
parameters: | ||
cpu: "" | ||
memory: "" | ||
service: | ||
requirements: # Requirements | ||
frisbee.io/pvc: datastore # Will create a PVC and mount the volume | ||
pvc.frisbee.io/spec: | | ||
storageClassName: ssd-storage | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 15Gi | ||
volumes: # Manual volumes | ||
- name: in-memory | ||
emptyDir: | ||
medium: Memory | ||
agents: # Agents | ||
telemetry: [ platform.telemetry.container, tikv.telemetry.pd ] | ||
resources: # Resources | ||
cpu: {{"{{.Inputs.Parameters.cpu}}" | quote}} | ||
memory: {{"{{.Inputs.Parameters.memory}}" | quote}} | ||
container: # Container | ||
name: app | ||
image: icsforth/tikv-pd-coverage | ||
volumeMounts: | ||
- name: datastore | ||
mountPath: /store | ||
ports: | ||
- name: to-clients | ||
containerPort: 2379 | ||
- name: to-cluster | ||
containerPort: 2380 | ||
- name: coverage | ||
containerPort: 80 | ||
command: | ||
- /bin/sh # Run shell | ||
- -c # Read from string | ||
- | # Multi-line str | ||
set -eum | ||
trap "touch /dev/shm/stop" EXIT | ||
echo "Starting goc server" | ||
/goc server &>/dev/null & | ||
echo "Starting lcov webserver at :80 Path:/var/www/localhost/htdocs/" | ||
lighttpd -f /etc/lighttpd/lighttpd.conf | ||
echo "Starting the instrumented binary" | ||
rm -rf /store/$${HOSTNAME} | ||
mkdir -p /store/$${HOSTNAME}/pd | ||
/instr_bin \ | ||
--client-urls=http://0.0.0.0:2379 \ | ||
--advertise-client-urls=http://$${HOSTNAME}:2379 \ | ||
--peer-urls=http://0.0.0.0:2380 \ | ||
--advertise-peer-urls=http://$${HOSTNAME}:2380 \ | ||
--data-dir=/store/$${HOSTNAME}/pd & | ||
sleep 10 | ||
echo "Periodically update the coverage report" | ||
while true | ||
do | ||
echo "Update coverage" | ||
# Get the report in the go cover format | ||
/goc profile | \ | ||
# Convert it to lcov format | ||
/gcov2lcov > /tmp/profile.out | \ | ||
# Generate http. | ||
genhtml -o /var/www/localhost/htdocs/ /tmp/profile.out &> /dev/null | ||
sleep 30 | ||
done | ||
--- | ||
apiVersion: frisbee.io/v1alpha1 | ||
kind: Template | ||
metadata: | ||
name: tikv.cluster.coverage.worker | ||
labels: | ||
app.kubernetes.io/managed-by: {{.Release.Service | quote}} | ||
spec: | ||
inputs: | ||
parameters: | ||
placementDriver: "localhost" | ||
cpu: "" | ||
memory: "" | ||
service: | ||
requirements: # Requirements | ||
frisbee.io/pvc: datastore # Will create a PVC and mount the volume | ||
pvc.frisbee.io/spec: | | ||
storageClassName: ssd-storage | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 15Gi | ||
volumes: # Manual volumes | ||
- name: in-memory | ||
emptyDir: | ||
medium: Memory | ||
agents: # Agents | ||
telemetry: [ platform.telemetry.container, tikv.telemetry.worker ] | ||
resources: # Resources | ||
cpu: {{"{{.Inputs.Parameters.cpu}}" | quote}} | ||
memory: {{"{{.Inputs.Parameters.memory}}" |quote}} | ||
container: # Container | ||
name: app | ||
image: localhost:32000/tikv-datanode-coverage2 | ||
volumeMounts: | ||
- name: in-memory | ||
mountPath: /store | ||
ports: | ||
- name: clusterbus | ||
containerPort: 20160 | ||
command: | ||
- /bin/sh # Run shell | ||
- -c # Read from string | ||
- | # Multi-line str | ||
set -eum | ||
trap "touch /dev/shm/stop" EXIT | ||
# increase the maximum number of open file descriptors | ||
ulimit -n 82920 | ||
rm -rf /store/$${HOSTNAME} | ||
mkdir -p /store/$${HOSTNAME}/data | ||
# see https://github.com/tikv/tikv/blob/master/etc/config-template.toml | ||
cat > config.toml <<EOF | ||
log-file = "/var/log/tikv-server.log" | ||
[server] | ||
addr="0.0.0.0:20160" | ||
advertise-addr="$${HOSTNAME}:20160" | ||
# used by the prometheus agent | ||
status-addr = "127.0.0.1:20180" | ||
[pd] | ||
endpoints = ["{{"{{.Inputs.Parameters.placementDriver}}"}}:2379"] | ||
[storage] | ||
reserve-space = "0" | ||
data-dir = "/store/$${HOSTNAME}/data" | ||
EOF | ||
echo "Start profiler" | ||
mkdir -p /source/coverage | ||
kcov --exclude-pattern=/usr /var/www/html/ ./target/debug/tikv-server --config=config.toml |
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
Submodule gcov2lcov
added at
f7e321
Oops, something went wrong.