gpt4 book ai didi

r - 调度程序绘图以可视化构建过程

转载 作者:行者123 更新时间:2023-12-04 18:13:04 24 4
gpt4 key购买 nike

我想为此使用 ggplot2 但不知道在哪里看。我有一个全局开始和结束时间 min(begin)max(end)分别是我的x轴。我的 y 轴将是每个处理器,我的数据包括每个处理器的时间 block ,编译器将忙于编译或链接特定文件。我想查看处理器空闲的空白区域。我的 df 看起来像这样:

df <- data.frame(proc = as.factor(c('P_1', 'P_1', 'P_1', 'P_2', 'P_2', 'P_3')), begin=c(1, 20, 23 , 3, 5, 8), end=c(5, 19, 21, 4, 9, 100), what=c('compiling A', 'compiling B', 'linking A', 'compiling C', 'compiling D', 'compiling E'))
df
> df
proc begin end what
1 P_1 1 5 compiling A
2 P_1 20 19 compiling B
3 P_1 23 21 linking A
4 P_2 3 4 compiling C
5 P_2 5 9 compiling D
6 P_3 8 100 compiling E
>

我怎样才能做到这一点?

最佳答案

像这样的东西?

library(ggplot2)
ggplot(df, aes(x=begin, xend=end, y=proc, yend=proc, colour=what)) +
geom_segment(size=5)

enter image description here

关于r - 调度程序绘图以可视化构建过程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12237028/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com