1
1
# Worker class
2
2
3
- begin <- proc.time()[3 ]
4
-
5
3
# NOTE: We use "stdin" to get the process stdin instead of the command line
6
4
inputConStdin <- file(" stdin" , open = " rb" )
7
5
@@ -67,11 +65,6 @@ numPartitions <- SparkR:::readInt(inputCon)
67
65
68
66
isEmpty <- SparkR ::: readInt(inputCon )
69
67
70
- metadataEnd <- proc.time()[3 ]
71
- dataReadEnd <- metadataEnd
72
- computeEnd <- dataReadEnd
73
- writeEnd <- computeEnd
74
-
75
68
if (isEmpty != 0 ) {
76
69
77
70
if (numPartitions == - 1 ) {
@@ -81,15 +74,12 @@ if (isEmpty != 0) {
81
74
} else {
82
75
data <- readLines(inputCon )
83
76
}
84
- dataReadEnd <- proc.time()[3 ]
85
77
output <- do.call(execFunctionName , list (splitIndex , data ))
86
- computeEnd <- proc.time()[3 ]
87
78
if (isOutputSerialized ) {
88
79
SparkR ::: writeRawSerialize(outputCon , output )
89
80
} else {
90
81
SparkR ::: writeStrings(outputCon , output )
91
82
}
92
- writeEnd <- proc.time()[3 ]
93
83
} else {
94
84
if (isInputSerialized ) {
95
85
# Now read as many characters as described in funcLen
@@ -98,7 +88,6 @@ if (isEmpty != 0) {
98
88
data <- readLines(inputCon )
99
89
}
100
90
101
- dataReadEnd <- proc.time()[3 ]
102
91
res <- new.env()
103
92
104
93
# Step 1: hash the data to an environment
@@ -116,8 +105,6 @@ if (isEmpty != 0) {
116
105
}
117
106
invisible (lapply(data , hashTupleToEnvir ))
118
107
119
- computeEnd <- proc.time()[3 ]
120
-
121
108
# Step 2: write out all of the environment as key-value pairs.
122
109
for (name in ls(res )) {
123
110
SparkR ::: writeInt(outputCon , 2L )
@@ -126,7 +113,6 @@ if (isEmpty != 0) {
126
113
length(res [[name ]]$ data ) <- res [[name ]]$ counter
127
114
SparkR ::: writeRawSerialize(outputCon , res [[name ]]$ data )
128
115
}
129
- writeEnd <- proc.time()[3 ]
130
116
}
131
117
}
132
118
@@ -142,13 +128,5 @@ unlink(inFileName)
142
128
# Restore stdout
143
129
sink()
144
130
145
- end <- proc.time()[3 ]
146
-
147
- cat(" stats: total " , (end - begin ), " \n " , file = stderr())
148
- cat(" stats: metadata " , (metadataEnd - begin ), " \n " , file = stderr())
149
- cat(" stats: input read " , (dataReadEnd - metadataEnd ), " \n " , file = stderr())
150
- cat(" stats: compute " , (computeEnd - dataReadEnd ), " \n " , file = stderr())
151
- cat(" stats: output write " , (writeEnd - computeEnd ), " \n " , file = stderr())
152
-
153
131
# Finally print the name of the output file
154
132
cat(outputFileName , " \n " )
0 commit comments