Prechádzať zdrojové kódy

Merge branch 'candidate-8.6.x'

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 3 rokov pred
rodič
commit
eee5f3012d

+ 27 - 0
ecl/eclccserver/eclccserver.cpp

@@ -351,6 +351,8 @@ class EclccCompileThread : implements IPooledThread, implements IErrorReporter,
         {
             Owned<IPipeProcess> pipe = createPipeProcess();
             AbortPipeWaiter aborter(abortWaiter, pipe);
+            bool timeCompiles = workunit->getDebugValueBool("timeCompiles", true);
+            CCycleTimer compileTimer(timeCompiles);
             int ret = START_FAILURE;
             if (pipe->run(nullptr, cmd, ".", false, true, true, 1024*1024))
             {
@@ -371,6 +373,31 @@ class EclccCompileThread : implements IPooledThread, implements IErrorReporter,
                     output.append(read, buf);
                 }
             }
+
+            if (timeCompiles)
+            {
+                StringBuffer scope;
+                const char * source = strchr(cmd, '"');
+                const char * end = nullptr;
+                if (source)
+                    source = strchr(source+1, '"');
+                if (source)
+                    source = strchr(source+1, '"');
+                if (source)
+                    end = strchr(source+1, '"');
+
+                //Extract the name of the file being compiled - and spot the link step because the input is a .o.
+                StringBuffer filename;
+                if (end)
+                    filename.append((end - source) - 1, source+1);
+                const char * extension = strrchr(filename, '.');
+                if (!extension || strncmp(extension, ".o", 2) == 0)
+                    filename.set("link");
+
+                scope.append("compile:compile c++:").append(filename);
+                workunit->setStatistic(queryStatisticsComponentType(), queryStatisticsComponentName(), SSTcompilestage, scope, StTimeElapsed, NULL, compileTimer.elapsedNs(), 1, 0, StatsMergeReplace);
+            }
+
             return ret;
         }
         catch (IException *E)

+ 7 - 3
esp/src/src-react/hooks/grid.tsx

@@ -142,10 +142,10 @@ function useFluentStoreGrid({
     const [sorted, setSorted] = React.useState<QuerySortItem>(sort);
     const [selection, setSelection] = React.useState([]);
     const [items, setItems] = React.useState<any[]>([]);
-    const [total, setTotal] = React.useState<number>();
+    const [total, setTotal] = React.useState<number>(0);
 
     const refreshTable = React.useCallback(() => {
-        if (isNaN(start) || isNaN(count)) return;
+        if (isNaN(start) || (isNaN(count) || count === 0)) return;
         const storeQuery = store.query(query ?? {}, { start, count, sort: sorted ? [sorted] : undefined });
         storeQuery.total.then(total => {
             setTotal(total);
@@ -278,7 +278,11 @@ export function useFluentPagedGrid({
     const [page, setPage] = React.useState(0);
     const [persistedPageSize, setPersistedPageSize] = useUserStore(`${persistID}_pageSize`, "25");
     const pageSize = React.useMemo(() => {
-        return parseInt(persistedPageSize);
+        const retVal = parseInt(persistedPageSize);
+        if (isNaN(retVal)) {
+            return 0;
+        }
+        return retVal;
     }, [persistedPageSize]);
     const { Grid, selection, copyButtons, total, refreshTable } = useFluentStoreGrid({ store, query, sort, start: page * pageSize, count: pageSize, columns, filename });
     const [theme] = useUserTheme();

+ 1 - 1
esp/src/src-react/hooks/store.ts

@@ -9,7 +9,7 @@ function useStore(store: IKeyValStore, key: string, defaultValue?: string, monit
     React.useEffect(() => {
         if (!store) return;
         store.get(key).then(value => {
-            setValue(value === undefined ? defaultValue : value);
+            setValue(typeof value !== "string" ? defaultValue : value);
         }).catch(e => {
             setValue(defaultValue);
         });

+ 6 - 1
system/jlib/jdebug.hpp

@@ -143,12 +143,17 @@ struct ITimeReporter : public IInterface
 extern jlib_decl cycle_t oneSecInCycles;
 class CCycleTimer
 {
-    cycle_t start_time;
+    cycle_t start_time = 0;
 public:
     inline CCycleTimer()
     {
         reset();
     }
+    inline CCycleTimer(bool enabled)
+    {
+        if (enabled)
+            reset();
+    }
     inline void reset()
     {
         start_time = get_cycles_now();