• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.adservices.service.stats.pas;
18 
19 import static com.android.adservices.service.stats.AdsRelevanceStatusUtils.JS_RUN_STATUS_UNSET;
20 import static com.android.adservices.service.stats.AdsRelevanceStatusUtils.SIZE_UNSET;
21 
22 import com.android.adservices.service.stats.AdsRelevanceStatusUtils;
23 
24 import com.google.auto.value.AutoValue;
25 
26 /** Class for logging execution of the encoding JavaScript stats. */
27 @AutoValue
28 public abstract class EncodingJsExecutionStats {
29     /** Returns the time to run the JavaScript. */
getJsLatency()30     public abstract int getJsLatency();
31 
32     /** Returns encoded signals size in bucket. */
33     @AdsRelevanceStatusUtils.Size
getEncodedSignalsSize()34     public abstract int getEncodedSignalsSize();
35 
36     /** Returns JavaScript run status. */
37     @AdsRelevanceStatusUtils.JsRunStatus
getRunStatus()38     public abstract int getRunStatus();
39 
40     /** Returns how much memory did the JavaScript use. */
getJsMemoryUsed()41     public abstract int getJsMemoryUsed();
42 
43     /** Returns AdTech's eTLD+1 when the JsRunStatus is not success. */
getAdTechId()44     public abstract String getAdTechId();
45 
46     /** Returns generic builder. */
builder()47     public static Builder builder() {
48         return new AutoValue_EncodingJsExecutionStats.Builder()
49                 .setJsLatency(SIZE_UNSET)
50                 .setEncodedSignalsSize(SIZE_UNSET)
51                 .setRunStatus(JS_RUN_STATUS_UNSET)
52                 .setJsMemoryUsed(0)
53                 .setAdTechId("");
54     }
55 
56     /** Builder class for EncodingJsExecutionStats. */
57     @AutoValue.Builder
58     public abstract static class Builder {
setJsLatency(int value)59         public abstract Builder setJsLatency(int value);
60 
setEncodedSignalsSize(@dsRelevanceStatusUtils.Size int value)61         public abstract Builder setEncodedSignalsSize(@AdsRelevanceStatusUtils.Size int value);
62 
setRunStatus(@dsRelevanceStatusUtils.JsRunStatus int value)63         public abstract Builder setRunStatus(@AdsRelevanceStatusUtils.JsRunStatus int value);
64 
setJsMemoryUsed(int value)65         public abstract Builder setJsMemoryUsed(int value);
66 
setAdTechId(String value)67         public abstract Builder setAdTechId(String value);
68 
build()69         public abstract EncodingJsExecutionStats build();
70     }
71 }
72